| Author |
RMI Server and clientID
|
Miguel Roque
Ranch Hand
Joined: Oct 24, 2002
Posts: 126
|
|
Hello. I'me making my server and I have some problems with it. I have it as follows: The connection to the database in the client side is made using a connection factory as follows: And the RemoteServerImplementation is created as follows: My question is, how can I get a unique clientID? I've tried some methods from RMI like getClientHost() and others, but if I open 2 clients i get the same values ! Thanks, Miguel
|
 |
John Smith
Ranch Hand
Joined: Oct 08, 2001
Posts: 2937
|
|
My question is, how can I get a unique clientID? I've tried some methods from RMI like getClientHost() and others, but if I open 2 clients i get the same values !
A common solution to this problem is to use a RMI Factory Pattern. Essentially, you bind a factory to the registry, the client gets the factory, invokes a method on that factory, and the factory creates another remote object which can be used to call the business methods. This remote object itself can then be used as a client identity. That is, all clients use the same object when they look up the registry, but each client gets a unique remote object to play with. This "RMI factory" is such as clear and powerful pattern, that it is really hard to find a good alternative solution. That's why the most cowboys here take it as it is. Eugene. [ January 16, 2003: Message edited by: Eugene Kononov ]
|
 |
Deedy Dee
Greenhorn
Joined: Mar 20, 2002
Posts: 13
|
|
How to manage the clientId in the server side, If apply the RMI Factory DP? deedy
|
-deedy
|
 |
 |
|
|
subject: RMI Server and clientID
|
|
|