Class ProcessExecutorClient

  • All Implemented Interfaces:
    ProcessExecutor

    public class ProcessExecutorClient
    extends AbstractProcessExecutor
    ProcessExecutor implementation delegating all execution requests to a remote server (a small JVM, which can spawn the processes more efficiently).

    The sub process (the server) is executed on construction time of this object and terminated when this object's quit() method is called.

    • Field Detail

      • EMMA_COVERAGE_ANNOUNCE

        public static final java.lang.String EMMA_COVERAGE_ANNOUNCE
        When the remote server has emma test coverage enabled, the started java VM outputs this message (to stdout). This message must be recognized and skipped to correctly receive the server's proprietary start message.
        See Also:
        ProcessExecutorServer.START_CONFIRMATION, Constant Field Values
    • Constructor Detail

      • ProcessExecutorClient

        public ProcessExecutorClient​(org.apache.commons.configuration.Configuration conf,
                                     RMIRegistryService rmiReg,
                                     ProcessContextRegistry contextReg,
                                     java.lang.String tenantName)
                              throws java.io.IOException,
                                     java.rmi.NotBoundException
        constructs a new client, starts the ProcessExecutorServer and connects to it.
        Parameters:
        conf - the Configuration containing information how to spawn the server.
        rmiReg - the rmi registry to use
        contextReg - the process context registry to use for call back handling
        tenantName - the current tenant's name
        Throws:
        java.io.IOException - if the sub process could not be spawned correctly or the any other communication error occurred.
        java.rmi.NotBoundException - if the server was not correctly bound to the rmi registry
    • Method Detail

      • quit

        public void quit()
                  throws java.io.IOException
        Description copied from interface: ProcessExecutor
        Terminates this ProcessExecutor and frees all associated resources. Note the lifecycle of a ProcessExecutor has tenant scope, i.e. there is no need to call ProcessExecutor.quit() except when shutting down the server (what will be done automatically).
        Throws:
        java.io.IOException - on any error
      • execute

        public int execute​(ProcessContext ctx)
                    throws java.io.IOException
        Description copied from interface: ProcessExecutor
        Synchronously executes the given ProcessContext.
        Parameters:
        ctx - the context to execute
        Returns:
        the exit code of the underlying os process.
        Throws:
        java.io.IOException - on eny error while executing the process.