What happens when I synchronize my remote methods? What does it synchronize on? Is there distributed synchronization?

Doug Bell

Synchronization in RMI is based entirely on the synchronization facilities of the Java language. While RMI provides a distributed garbage collection facility built on top of the local JVM garbage collection, there is no such similar facility provided for synchronization.

So the result is that if you synchronized on a remote stub, the synchronization takes place in the client JVM only. Conversely, if you declare a remote method as synchronized in the remote object implementation, the synchronization takes place in the server JVM, which has the effect of synchronizing all client and server access to the remote object.