Hey guys! I'd coax your to re-read the RMI spec.:
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. Since remote method invocation on the same remote object may execute concurrently, a remote object implementation needs to make sure its implementation is thread-safe. (
http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmi-arch3.html)
Although ususally your suggestion works you souldn'g rely on it (unless you're not afraid to lose several points).
I'm gonna implement a ConnectionFactory and to shoulder on it responsibility for getting new connection to the DB (RMI object that in its turn implements Runnable and here works in own thread)
[This message has been edited by Roman Rytov (edited January 02, 2002).]