Thanks for your message, but I am afraid the problem is different. Let me explain it better with this code:
1) The monitor is exported to the RMI registry
2) Proxy is an object created at AnotherClass and when AnotherClass invokes wait() the proxy holds the lock.
3) Proxy is not exported to the RMI registry
4) When Monitor constructor is executed the output is:
These 3 classes are running in a JVM1 and the update() method is invoked by another object that runs in a JVM2. All them in both JVMs are exported to RMI registry, one registry in JVM1 and another at JVM2. The code is not complete since it is long and complex. I´ve tried to put something that focus on the problem.
In JVM1 then proxy calls wait() and own the lock, the problem is that at the time it is exported to the registry at JVM1 the stub at the registry that receives the notification from JVM2 that invokes update(). In this case, the update at the stub cannot call NotifyAll() since it does not own the lock. So no effect in the code...
subject: JVM copies an object when it is exported to RMI registry?