|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.util.newjvm.AbstractMasterJVM
public abstract class AbstractMasterJVM
An abstract class implementing the logic to invoke and control, via RMI, a second Java virtual machine. This class is used by subclassing it. (See package documentation for more details.) This class runs in both the master and the slave JVMs.
Field Summary | |
---|---|
static Log |
_log
|
protected Object |
_masterJVMLock
Lock for accessing the critical state of this AbstractMasterJVM including _monitorThread. |
protected SlaveRemote |
_slave
The slave JVM remote stub if it's connected; null if not connected. |
protected String |
_waitForQuitThreadName
Name for the thread that waits for the slave to exit. |
Constructor Summary | |
---|---|
protected |
AbstractMasterJVM(String slaveClassName)
Sets up the master JVM object, but does not actually invoke the slave JVM. |
Method Summary | |
---|---|
void |
checkStillAlive()
No-op to prove that the master is still alive. |
void |
dispose()
Withdraws RMI exports for this. |
abstract void |
errorStartingSlave(Throwable cause)
Called if the slave JVM dies before it is able to register. |
protected SlaveRemote |
getSlave()
Returns slave remote instance, or null if not connected. |
protected abstract void |
handleSlaveConnected()
Callback for when the slave JVM has connected, and the bidirectional communications link has been established. |
protected abstract void |
handleSlaveQuit(int status)
Callback for when the slave JVM has quit. |
protected void |
invokeSlave()
Invokes slave JVM without any JVM arguments. |
protected void |
invokeSlave(String[] jvmArgs,
File workDir)
Invokes slave JVM, using the system classpath. |
protected void |
invokeSlave(String[] jvmArgs,
String cp,
File workDir)
Creates and invokes slave JVM. |
protected boolean |
isStartupInProgress()
Returns true if the slave is in the process of starting. |
protected void |
quitSlave()
Quits slave JVM. |
void |
registerSlave(SlaveRemote slave)
Registers a slave JVM. |
protected void |
slaveQuitDuringStartup(int status)
Action to take if the slave JVM quits before registering. |
void |
waitSlaveDone()
Waits until no slave JVM is running under control of "this" |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Log _log
protected volatile String _waitForQuitThreadName
protected final Object _masterJVMLock
protected volatile SlaveRemote _slave
Constructor Detail |
---|
protected AbstractMasterJVM(String slaveClassName) throws RemoteException
slaveClassName
- The fully-qualified class name of the class to start up in the second JVM. This class must
implement the interface specified by this class's type parameter, which must be a subclass of SlaveRemote
.
RemoteException
Method Detail |
---|
protected abstract void handleSlaveConnected()
getSlave()
is guaranteed to not return null.
protected abstract void handleSlaveQuit(int status)
getSlave()
is guaranteed to return null.
status
- The exit code returned by the slave JVM.protected final void invokeSlave() throws IOException, RemoteException
IllegalStateException
- if slave JVM already connected or startUp is in progress.
IOException
RemoteException
protected final void invokeSlave(String[] jvmArgs, File workDir) throws IOException, RemoteException
jvmArgs
- Array of arguments to pass to the JVM on startUp
IllegalStateException
- if slave JVM already connected or startUp is in progress.
IOException
RemoteException
protected final void invokeSlave(String[] jvmArgs, String cp, File workDir) throws IOException, RemoteException
jvmArgs
- Array of arguments to pass to the JVM on startUpcp
- Classpath to use when starting the JVM
IllegalStateException
- if slave JVM already connected or startUp is in progress.
IOException
RemoteException
public void waitSlaveDone()
protected void slaveQuitDuringStartup(int status)
status
- Status code of the JVMpublic abstract void errorStartingSlave(Throwable cause) throws RemoteException
errorStartingSlave
in interface MasterRemote
cause
- The Throwable which caused the slave to die.
RemoteException
public void checkStillAlive()
checkStillAlive
in interface MasterRemote
public void registerSlave(SlaveRemote slave) throws RemoteException
MasterRemote
registerSlave
in interface MasterRemote
RemoteException
public void dispose() throws RemoteException
RemoteException
protected final void quitSlave() throws RemoteException
IllegalStateException
- if no slave JVM is connected
RemoteException
protected final SlaveRemote getSlave()
protected boolean isStartupInProgress()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |