public class MultiThreadManager
extends java.lang.Object
implements java.util.concurrent.ExecutorService
Constructor and Description |
---|
MultiThreadManager(java.lang.String name,
int nPrimaryThreads,
int nSecondaryThreads,
long timeoutMS)
Creates primary and secondary thread pools
|
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future<?> |
awaitNextCompleted() |
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.util.concurrent.Callable<?> command) |
void |
execute(java.lang.Runnable command)
Executes the supplied command at some time in the future.
|
java.util.concurrent.Future<?> |
executeSecondary(java.lang.Runnable command) |
java.util.concurrent.Future<?> |
getNextCompleted() |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
<T> java.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> task) |
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task) |
<T> java.util.concurrent.Future<T> |
submit(java.lang.Runnable task,
T result) |
<T> java.util.concurrent.Future<T> |
submitSecondary(java.util.concurrent.Callable<T> task) |
java.util.concurrent.Future<?> |
submitSecondary(java.lang.Runnable task) |
<T> java.util.concurrent.Future<T> |
submitSecondary(java.lang.Runnable task,
T result) |
public MultiThreadManager(java.lang.String name, int nPrimaryThreads, int nSecondaryThreads, long timeoutMS)
name
- name of the thread managernPrimaryThreads
- fixed number of threads in the primary poolnSecondaryThreads
- maximum number of threads in the secondary pooltimeoutMS
- thread time-outpublic void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
public void execute(java.util.concurrent.Callable<?> command)
public java.util.concurrent.Future<?> executeSecondary(java.lang.Runnable command)
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
submit
in interface java.util.concurrent.ExecutorService
public <T> java.util.concurrent.Future<T> submitSecondary(java.util.concurrent.Callable<T> task)
public <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task, T result)
submit
in interface java.util.concurrent.ExecutorService
public <T> java.util.concurrent.Future<T> submitSecondary(java.lang.Runnable task, T result)
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit
in interface java.util.concurrent.ExecutorService
public java.util.concurrent.Future<?> submitSecondary(java.lang.Runnable task)
public java.util.concurrent.Future<?> getNextCompleted()
public java.util.concurrent.Future<?> awaitNextCompleted()
public void shutdown()
shutdown
in interface java.util.concurrent.ExecutorService
public java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow
in interface java.util.concurrent.ExecutorService
public boolean isShutdown()
isShutdown
in interface java.util.concurrent.ExecutorService
public boolean isTerminated()
isTerminated
in interface java.util.concurrent.ExecutorService
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
awaitTermination
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException
invokeAll
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
invokeAll
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
public <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException