JavaParty Logo

JavaParty

A distributed companion to Java
Current release 1.9.5

Bernhard Haumacher, Thomas Moschny and Michael Philippsen

Contents
General
 Features
 Requirements
 DownloadNew!
 Mailing ListsNew!
 Setup
 Quick Tour
 Command Reference
 API
Language
 Syntax
 Object Model
 Transparent Threads
 Distributed ThreadsCool!
displayed pageRMACool!
 Synchronization
 Object Location
 Migration
 Remote Threads
 Replicated ObjectsCool!
 Multi-Application
Tuning
 Debugging
 uka.transport
 KaRMICool!
 KaRMI API
 Myrinet/GM
 OpenPBS
Examples
 Hello JavaParty
 ObjectModel
 BenchmarksNew!
Other info
 Papers
 Trouble Shooting
 History


See also
 CJ
 Generic Java


Powered by
Apache Ant
SourceForge
Subversion

Remote Monitor Access (RMA)

Since JavaParty 1.07a

KaRMI is able to remotely access synchronization monitors of objects on far nodes. With this construct the implementation of transparent synchronized blocks on remote objects is possible.

Implementing remote monitor access is non-trivial, because there are specific restrictions regarding the byte code instructions dealing with acquiring and releasing the monitor of an object. These instructions must always be paired, to assert that a monitor acquired in some block of code is released when the control flow leaves this block. This restriction is checked by the byte code verifier at class loading time.

Since Java synchronization is bound on static blocks even in byte code, one can not implement an remote monitor acquire by calling a remote method of an object and issuing a single monitorEnter instruction there. The corresponding monitorExit instruction must occur before the control flow leaves this remote method.

Using the unique representative thread approach described in the section Distributed Threads, it is nevertheless possible to instruct a representative thread for the current distributed thread to acquire and hold the lock of a remote object, while executing a code block locally. The implementation in KaRMI is done using a special remote invocation with early return capabilities as seen in figure 1.

Figure 1. Sequence diagram of remote monitor access.

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.

Please also refer to the paper "Transparent Distributed Threads for Java".


For comments and bug reports please use the JavaParty users mailing list.
Page design & maintenance: Bernhard Haumacher.
Last update: Fri Mar 30 18:46:00 GMT+01:00 2007
Java is a trademark of Sun Microsystems.