Friday, June 15, 2001 07:29 AM
First -- you do not get an instance of the remote object but rather a reference to the instance of the remote object. Think of the String Object within a JVM:
String a = new String("AAAA");
String b = a;
Both a and b are references to the same object "AAAA".
The RMI Registry contains a reference to the remote object, 'Engine'. Any client may
contact the Registry and request a reference to 'Engine'. Any client may invoke methods in 'Engine' in any order, so the work the methods do must be thread safe.
The RMI Runtime [usually] creates a new RMI-Connection thread for each request, (method invocation from a client). While the methods themselves are not synchronized, if you
manipulate any data that are shared between threads, then you must do that which is necessary to assure integrity, (this usually means to use the synchronized statement.)