Does the server need to be multithreaded in the FBN application? I stumbled upon a statement that reads: "You may implement your threaded server in more than one class if you choose." The "threaded server" bit intrigues me. Does the server need to span multiple threads? If yes, what do I need to do special on the server side to know when a client has established a connection? Is it possible to derive some sort of client ID to be used in locking if the server is single threaded? Thanks!
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).]
SCJA, SCJD, MCSD
Joined: Jun 13, 2001
Hi Roman Of course you are right. That is what the spec says. ANd it is true you have to make your objects thread safe. But when I say RMI handles your threading I mean you do not need to write your own thread pools, or assign theads to clients etc. All these things you have to do in a socket based solution. In RMI you just have to make your objects thread safe Trevor