Class ProcessSpawner

java.lang.Object
org.jcsp.net.remote.ProcessSpawner
All Implemented Interfaces:
CSProcess

class ProcessSpawner extends 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 the System.err or System.out streams.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ApplicationID
    The application identifier of the caller that the child should adopt.
    private final NetChannelOutput
    For sending data back to the calling JVM who is running the RemoteProcess proxy.
    private final String
    The classpath the spawned JVM should use to get the caller's classes from a networked filesystem or null if the default classpath should be used.
    private final NodeFactory
    The factory the child should use to initialize its node or null if the default initialization should take place.
    (package private) static final int
    An Exception follows that was raised by the spawned process.
    (package private) static final int
    An Exception follows that was raised by the spawned process on failure.
    (package private) static final int
    The process terminated without error.
    (package private) static final int
    A String follows with a line of text that was for System.err.
    (package private) static final int
    A String follows with a line of text that was for System.out.
    private static final Integer
    An Exception follows that was raised by the spawned process.
    private static final Integer
    An Exception follows that was raised by the spawned process on failure.
    private static final Integer
    The process terminated without error.
    private static final Integer
    A String follows with a line of text that was for System.err.
    private static final Integer
    A String follows with a line of text that was for System.out.
    private final CSProcess
    The process that needs to be started.
    private final SpawnerService
    The parent service that started this one.
    private final String
    A 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, String classPath)
    Constructs a new spawner.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Main process loop.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MSG_STDOUT

      static final int MSG_STDOUT
      A String follows with a line of text that was for System.out.
      See Also:
    • MSG_STDERR

      static final int MSG_STDERR
      A String follows with a line of text that was for System.err.
      See Also:
    • MSG_EXCEPTION

      static final int MSG_EXCEPTION
      An Exception follows that was raised by the spawned process.
      See Also:
    • MSG_FAIL

      static final int MSG_FAIL
      An Exception follows that was raised by the spawned process on failure.
      See Also:
    • MSG_OK

      static final int MSG_OK
      The process terminated without error.
      See Also:
    • msgSTDOUT

      private static final Integer msgSTDOUT
      A String follows with a line of text that was for System.out.
    • msgSTDERR

      private static final Integer msgSTDERR
      A String follows with a line of text that was for System.err.
    • msgEXCEPTION

      private static final Integer msgEXCEPTION
      An Exception follows that was raised by the spawned process.
    • msgFAIL

      private static final Integer msgFAIL
      An Exception follows that was raised by the spawned process on failure.
    • msgOK

      private static final 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 the RemoteProcess proxy.
    • factory

      private final NodeFactory factory
      The factory the child should use to initialize its node or null if 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 String uniqueName
      A unique name generated by the service fo use in creating a temporary file.
    • classPath

      private final String classPath
      The classpath the spawned JVM should use to get the caller's classes from a networked filesystem or null if the default classpath should be used.
  • Constructor Details

    • ProcessSpawner

      public ProcessSpawner(SpawnerService service, CSProcess process, NetChannelOutput caller, NodeFactory factory, ApplicationID applicationID, int unique, 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.
  • Method Details

    • run

      public void run()
      Main process loop.
      Specified by:
      run in interface CSProcess