Package org.daisy.dotify.devtools.jvm
Class ProcessStarterAsync
- java.lang.Object
-
- org.daisy.dotify.devtools.jvm.ProcessStarterAsync
-
public class ProcessStarterAsync extends Object
-
-
Constructor Summary
Constructors Constructor Description ProcessStarterAsync()Creates a new asynchronous process starter with the same number of threads as there are processors available.ProcessStarterAsync(int threads)Creates a new asynchronous process starter with the specified number of threads.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProcess(String... command)Adds a new process to be executed as a thread becomes available.voidshutdown(long timeout, TimeUnit unit)Blocks until all processes have terminated.
-
-
-
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 IOExceptionBlocks until all processes have terminated.- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Throws:
IOException- if the shutdown is interrupted
-
-