⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jremotemonitor.java

📁 JAMPACK Grid programming
💻 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 + -