| 16 | 16 | When the red thread in figure 1 wants to acquire the monitor of remote object b, it sends a request to the node where object b lives and instructs the representative thread for the current distributed thread (the green one) to enter a synchronized block on object b. Immediately after the representative thread has entered the synchronized block, it sends an early return code back to the original thread. The red one now can be sure to hold the lock of object b on the remote node. The green representative thread on the home node of object b does not leave the synchronized block until it receives a second request to release the monitor. While staying within the synchronized block, the gree representative thread stays also listening for remote method invocations that may arrive at its node while holding the lock of object b. If such invocation occurred, they would be executed also by the green thread to make sure they can re-enter the synchronization already acquired remotely. |