?? jremotemonitor.java
字號:
/**
*
* Program : JRemoteMonitor.java
*
* Author : Vijayakrishnan Menon
*
* Date : 18th Dec 2005
*
* Organization : Centre for Excellence in
* Computational Engineering and Networking (CEN),
* Amrita Viswa Vidyapeetham
**/
package JAMPack;
/** Thread synchronization is an important aspect of distributed processing.
* This interface projects a distributed Object base sychronization model.
* the remote waiting and notify methods are anologues to the actual waith and
* notify native methods. It is neccesory for synching the remote threads as
* well as for barier functions that provides adhoc synchronization mechanisms
* for sensitive parallel activities
**/
interface RemoteMonitor extends java.rmi.Remote {
public void remoteWait() throws java.rmi.RemoteException;
public void remoteNotifyAll() throws java.rmi.RemoteException;
}
/** The remote class for "wait and notify" operations. This remote class is not
* singleton, Many instances are permitted. It is distributed, over each
* environment holding many remote instances of it. The job client is given an
* array of all grid members's objects. Posting the threadlets to remote
* threads is followed by a broadcast notifyall call that actually initiates
* the computations in a wave. The singleton instance is held by the
* Environment. All threads that starts have a remote monitor, the distribution
* any number per machine, all remote threads on same machine may or may not
* share the same remote monitor.
**/
public class JRemoteMonitor extends java.rmi.server.UnicastRemoteObject implements RemoteMonitor {
private Object _moniter = new Object();
/** The lockobject Constructor. */
public JRemoteMonitor() throws java.rmi.RemoteException {
}
/** The remotewait is the remote anologue of the Object.wait() */
public void remoteWait() throws java.rmi.RemoteException {
synchronized (this._moniter) {
try { this._moniter.wait(); }
catch(InterruptedException e) { e.printStackTrace();}
}
}
/** The remoteNotifyAll is the analogue of the Object.notifyAll() */
public void remoteNotifyAll() throws java.rmi.RemoteException {
synchronized (this._moniter) {
this._moniter.notifyAll();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -