Class LimitedProcessExecutor

    • Constructor Detail

      • LimitedProcessExecutor

        public LimitedProcessExecutor​(int limit,
                                      ProcessExecutor executor)
        Creates a new LimitedProcessExecutor delegating all requests to the given executor and limiting parallel processes to the specified limit.
        Parameters:
        limit - the maximum number of parallel process to execute.
        executor - the ProcessExecutor to delegate to.
    • Method Detail

      • execute

        public int execute​(ProcessContext context)
                    throws java.io.IOException
        Delegates the execution request to the underlying ProcessExecutor, but blocking the current Thread if the maximum number of parallel processes has already been reached.

        Synchronously executes the given ProcessContext.

        Parameters:
        context - the context to execute
        Returns:
        the exit code of the underlying os process.
        Throws:
        java.io.IOException - on eny error while executing the process.
        See Also:
        ProcessExecutor.execute(ProcessContext)
      • quit

        public void quit()
                  throws java.io.IOException
        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
        See Also:
        ProcessExecutor.quit()