According to the specification defined with Java 1.4.2, RMI section 3.2,
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.No matter how confusing this specification is, it at least tells us two things,
- RMI does not take care of the thread safety, it leaves the thread safety as it is.
- RMI does not give you one server thread for one client thread, actually, it guarantees nothing on the thread scheduling.
As long as both the client objects and the server objects are thread-safe, the application is thread-safe.
No comments:
Post a Comment