edu.cmu.emulator.daemon
Class NodeDaemon

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by edu.cmu.emulator.daemon.NodeDaemon
All Implemented Interfaces:
DaemonInterface, Serializable, Runnable, Remote

public class NodeDaemon
extends UnicastRemoteObject
implements DaemonInterface, Runnable

The Daemon that runs on the nodes. This will be the server side of the RMI package.

See Also:
Serialized Form

Field Summary
private  EmuInterface emu
           
private static String emuHost
           
static int INVALID_PID
           
private  int nextProcID
           
private  String nodeName
           
private  HashMap processMap
           
private  boolean reaping
           
static int reapIntervalMillis
           
private  ArrayList reapList
           
static Stopwatch sw
           
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
NodeDaemon()
           
 
Method Summary
private  int addProcessToMap(Process p)
           
 int execProcess_NodeLogIO(String[] cmds, String stdoutLogName, String stderrLogName)
          Convenience routine to execProcess and log stdout and/or stderr on the node.
 int[] execProcess_RelayIO(String[] cmds, int ioOptions)
          Convenience routine to relay io to/from control node.
 int execProcess(String[] cmds)
           
 int execProcess(String[] cmds, ProcControl pc)
          Fundamental execProcess routine.
 EmuInterface getEmuInterface()
           
 String getNodeName()
           
 ArrayList getProcessIDList()
           
private  Process getProcessInMap(int pID)
           
private  Process getProcessInMap(Integer pID)
           
 void init(String nodeName, EmuInterface emu)
           
static void main(String[] args)
           
 void reInit()
           
private  Process removeProcessFromMap(int pID)
           
 void run()
           
 void sendMessageToEmu(int pID, Object msg)
           
 void stopProcess(int pID)
          Stop a remote process.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

processMap

private HashMap processMap

nextProcID

private int nextProcID

emu

private EmuInterface emu

nodeName

private String nodeName

reapList

private ArrayList reapList

reaping

private boolean reaping

INVALID_PID

public static final int INVALID_PID
See Also:
Constant Field Values

emuHost

private static String emuHost

reapIntervalMillis

public static final int reapIntervalMillis
See Also:
Constant Field Values

sw

public static final Stopwatch sw
Constructor Detail

NodeDaemon

public NodeDaemon()
           throws RemoteException
Throws:
RemoteException
Method Detail

init

public void init(String nodeName,
                 EmuInterface emu)
Specified by:
init in interface DaemonInterface

addProcessToMap

private int addProcessToMap(Process p)

removeProcessFromMap

private Process removeProcessFromMap(int pID)

getProcessInMap

private Process getProcessInMap(Integer pID)

getProcessInMap

private Process getProcessInMap(int pID)

execProcess

public int execProcess(String[] cmds,
                       ProcControl pc)
Fundamental execProcess routine.

Specified by:
execProcess in interface DaemonInterface
Parameters:
cmds - The array of strings which holds the command name and the arguements
Returns:
The ID of the process created

execProcess

public int execProcess(String[] cmds)
Specified by:
execProcess in interface DaemonInterface

execProcess_NodeLogIO

public int execProcess_NodeLogIO(String[] cmds,
                                 String stdoutLogName,
                                 String stderrLogName)
Convenience routine to execProcess and log stdout and/or stderr on the node.

Specified by:
execProcess_NodeLogIO in interface DaemonInterface

execProcess_RelayIO

public int[] execProcess_RelayIO(String[] cmds,
                                 int ioOptions)
Description copied from interface: DaemonInterface
Convenience routine to relay io to/from control node.

Specified by:
execProcess_RelayIO in interface DaemonInterface

getNodeName

public String getNodeName()

getEmuInterface

public EmuInterface getEmuInterface()

stopProcess

public void stopProcess(int pID)
Description copied from interface: DaemonInterface
Stop a remote process.

Specified by:
stopProcess in interface DaemonInterface
Parameters:
pID - The ID of the remote process.

reInit

public void reInit()
Specified by:
reInit in interface DaemonInterface

getProcessIDList

public ArrayList getProcessIDList()

sendMessageToEmu

public void sendMessageToEmu(int pID,
                             Object msg)

run

public void run()
Specified by:
run in interface Runnable

main

public static void main(String[] args)


Copyright © 2013. All Rights Reserved.