A method dispatched by the RMI runtime to a remote object implementation may or may not execute in a separate thread. The RMI runtime makes no guarantees with respect to mapping remote object invocations to threads.
Take a look at the following thread:
Andrew has done a wonderful job of explaining the Connection Factory concept in the most basic terms.
I think this may be due to the fact that RMI only create one thread for multiplex clients
However, there are one case in which one record can be locked twice in the network scheme.
I have no idea how to make sure one thread for each client. This may not be possible?
So even multiple Data objects are created, no guarantees that each Data object will executed with one thread. in which case, wait() can be called by the same thread twice or more because wait() and notifyAll() are based on "THREADS" instead of "OBJECTS", right?( When the thread is in wait(), it can execute some other methods, is it ture???) This can cause unexpected system behaviors.
Is [the code posted] the right way to implement Connection Factory?
Why have you hard coded "localhost" into your hostService string?