• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please review the ConnectionFactory .....

 
aadhi agathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic