Package org.jcsp.net.remote
Class ProcessSpawner
- java.lang.Object
-
- org.jcsp.net.remote.ProcessSpawner
-
- All Implemented Interfaces:
CSProcess
class ProcessSpawner extends java.lang.Object implements CSProcess
Launches a new JVM to run a process received by this spawner. This process will communicate with the new JVM, routing any exceptions to the requesting host and also any information printed to theSystem.errorSystem.outstreams.
-
-
Field Summary
Fields Modifier and Type Field Description private ApplicationIDapplicationIDThe application identifier of the caller that the child should adopt.private NetChannelOutputcallerFor sending data back to the calling JVM who is running theRemoteProcessproxy.private java.lang.StringclassPathThe classpath the spawned JVM should use to get the caller's classes from a networked filesystem ornullif the default classpath should be used.private NodeFactoryfactoryThe factory the child should use to initialize its node ornullif the default initialization should take place.(package private) static intMSG_EXCEPTIONAnExceptionfollows that was raised by the spawned process.(package private) static intMSG_FAILAnExceptionfollows that was raised by the spawned process on failure.(package private) static intMSG_OKThe process terminated without error.(package private) static intMSG_STDERRAStringfollows with a line of text that was forSystem.err.(package private) static intMSG_STDOUTAStringfollows with a line of text that was forSystem.out.private static java.lang.IntegermsgEXCEPTIONAnExceptionfollows that was raised by the spawned process.private static java.lang.IntegermsgFAILAnExceptionfollows that was raised by the spawned process on failure.private static java.lang.IntegermsgOKThe process terminated without error.private static java.lang.IntegermsgSTDERRAStringfollows with a line of text that was forSystem.err.private static java.lang.IntegermsgSTDOUTAStringfollows with a line of text that was forSystem.out.private CSProcessprocessThe process that needs to be started.private SpawnerServiceserviceThe parent service that started this one.private java.lang.StringuniqueNameA unique name generated by the service fo use in creating a temporary file.
-
Constructor Summary
Constructors Constructor Description ProcessSpawner(SpawnerService service, CSProcess process, NetChannelOutput caller, NodeFactory factory, ApplicationID applicationID, int unique, java.lang.String classPath)Constructs a new spawner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidrun()Main process loop.
-
-
-
Field Detail
-
MSG_STDOUT
static final int MSG_STDOUT
AStringfollows with a line of text that was forSystem.out.- See Also:
- Constant Field Values
-
MSG_STDERR
static final int MSG_STDERR
AStringfollows with a line of text that was forSystem.err.- See Also:
- Constant Field Values
-
MSG_EXCEPTION
static final int MSG_EXCEPTION
AnExceptionfollows that was raised by the spawned process.- See Also:
- Constant Field Values
-
MSG_FAIL
static final int MSG_FAIL
AnExceptionfollows that was raised by the spawned process on failure.- See Also:
- Constant Field Values
-
MSG_OK
static final int MSG_OK
The process terminated without error.- See Also:
- Constant Field Values
-
msgSTDOUT
private static final java.lang.Integer msgSTDOUT
AStringfollows with a line of text that was forSystem.out.
-
msgSTDERR
private static final java.lang.Integer msgSTDERR
AStringfollows with a line of text that was forSystem.err.
-
msgEXCEPTION
private static final java.lang.Integer msgEXCEPTION
AnExceptionfollows that was raised by the spawned process.
-
msgFAIL
private static final java.lang.Integer msgFAIL
AnExceptionfollows that was raised by the spawned process on failure.
-
msgOK
private static final java.lang.Integer msgOK
The process terminated without error.
-
service
private final SpawnerService service
The parent service that started this one.
-
process
private final CSProcess process
The process that needs to be started.
-
caller
private final NetChannelOutput caller
For sending data back to the calling JVM who is running theRemoteProcessproxy.
-
factory
private final NodeFactory factory
The factory the child should use to initialize its node ornullif the default initialization should take place.
-
applicationID
private final ApplicationID applicationID
The application identifier of the caller that the child should adopt.
-
uniqueName
private final java.lang.String uniqueName
A unique name generated by the service fo use in creating a temporary file.
-
classPath
private final java.lang.String classPath
The classpath the spawned JVM should use to get the caller's classes from a networked filesystem ornullif the default classpath should be used.
-
-
Constructor Detail
-
ProcessSpawner
public ProcessSpawner(SpawnerService service, CSProcess process, NetChannelOutput caller, NodeFactory factory, ApplicationID applicationID, int unique, java.lang.String classPath)
Constructs a new spawner.- Parameters:
service- the parent service that is creating this object.process- the process that should be run.caller- for sending data back to the caller.factory- optional factory for initializing the child process' node.applicationID- caller's application ID that the child should adopt.unique- a unique number allocated by the parent service.classPath- classpath specified by the caller process for any classes available from a networked filesystem.
-
-