aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes please review the ConnectionFactory ..... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "please review the ConnectionFactory ....." Watch "please review the ConnectionFactory ....." New topic
Author

please review the ConnectionFactory .....

aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
could someone please review the ConnectionFactory code and let me know of any holes.

i am just considering that the ConnectionFacory will be reused for different database files.
your comments are very much welcome. please help!
[ January 27, 2003: Message edited by: aadhi agathi ]

Aadhi
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
You've got the right idea, you code just needs some refactoring. You don't need to store server dns, port, and path to database in your "argument" hashmap: you can safely assume that there will be only one server running at any time. Consequently, all you need to keep in your map is the database name and its instance of data, along with its lockmanager. So the structure of your map may look like this:
[databasename --> (instance of Data, instance of lockmanager)]
That is, database name (without the path) is the key, and the pair (instance of Data, instance of lockmanager) is the value. My RemoteDataFactoryImpl class is very similar, but it's just 20 lines long. Talking about the class name, I would avoid "ConnectionFactoryTry": first, your class name should be a noun (or a combination of nouns/adjectives), and second, the postfix "try" in the class name may scare the users to instantiate/use the class
Eugene.
[ January 27, 2003: Message edited by: Eugene Kononov ]
aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
Originally posted by Eugene Kononov:
Consequently, all you need to keep in your map is the database name and its instance of data, along with its lockmanager. So the structure of your map may look like this:
[databasename --> (instance of Data, instance of lockmanager)]
I would avoid "ConnectionFactoryTry": first, your class name should be a noun (or a combination of nouns/adjectives), and second, the postfix "try" in the class name may scare the users to instantiate/use the class
Eugene.
[ January 27, 2003: Message edited by: Eugene Kononov ]

first, thanks a zillion Eugene, for reviewing. Actually i have another version of ConnectionFactory as you have pointed out. But as i wanted to reuse the COnnectionFactory, so i have tried this version

But i haven't got the server bind in the registry , but the clients do have the stub of the server as sell as the ConnectionFactory. what is the siqnificance of binding the server .won't it suffice to have only the Factory bind in the registry

Kindly comment and help a RMI Amateur .
[ January 27, 2003: Message edited by: aadhi agathi ]
[ January 27, 2003: Message edited by: aadhi agathi ]
aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
it works without the server being bound in the registry.
but will there be any significance of the server being bound to the registry. i feel it will be the other way round. ie., the client shouldn't bypass the ConnectionFactory.
comments please!
[ January 28, 2003: Message edited by: aadhi agathi ]
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

but will there be any significance of the server being bound to the registry. i feel it will be the other way round. ie., the client shouldn't bypass the ConnectionFactory.

There is no reason to bind anything to the registry if you already bind connection factory. The clients looks up the registry, gets the factory, invokes a method on that factory, and factory creates a remote object for the client.
Eugene.
aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
Originally posted by Eugene Kononov:

The clients looks up the registry, gets the factory, invokes a method on that factory, and factory creates a remote object for the client.
Eugene.

Great news indeed. Thanks for helping me out and did i mention the patience.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please review the ConnectionFactory .....
 
Similar Threads
Initial design review
ConnectionFactory coding the hard way
Remote Interface
idea for this pls?!
Lock Manager implementation