This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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 ]