Class ProcessStarterAsync


  • public class ProcessStarterAsync
    extends Object
    • Constructor Detail

      • ProcessStarterAsync

        public ProcessStarterAsync()
        Creates a new asynchronous process starter with the same number of threads as there are processors available.
      • ProcessStarterAsync

        public ProcessStarterAsync​(int threads)
        Creates a new asynchronous process starter with the specified number of threads.
        Parameters:
        threads - the number of threads to use
    • Method Detail

      • addProcess

        public void addProcess​(String... command)
        Adds a new process to be executed as a thread becomes available.
        Parameters:
        command - the command to execute
      • shutdown

        public void shutdown​(long timeout,
                             TimeUnit unit)
                      throws IOException
        Blocks until all processes have terminated.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Throws:
        IOException - if the shutdown is interrupted