public class SimpleThreadManager
extends java.lang.Object
implements java.util.concurrent.ExecutorService
Constructor and Description |
---|
SimpleThreadManager(java.lang.String name)
Creates primary thread pool
|
SimpleThreadManager(java.lang.String name,
int nThreads)
Creates primary thread pool
|
SimpleThreadManager(java.lang.String name,
int nThreads,
long timeoutMS)
Creates primary thread pool
|
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.
|
static int |
getDefaultNumThreads() |
java.util.concurrent.Future<?> |
getNextCompleted() |
boolean |
hasNextFuture() |
<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() |
java.util.concurrent.Future<?> |
popFuture() |
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) |
public SimpleThreadManager(java.lang.String name)
name
- name of the thread managerpublic SimpleThreadManager(java.lang.String name, int nThreads)
name
- name of the thread managernThreads
- fixed number of threads in the primary poolpublic SimpleThreadManager(java.lang.String name, int nThreads, long timeoutMS)
name
- name of the thread managernThreads
- fixed number of threads in the primary pooltimeoutMS
- thread time-outpublic static int getDefaultNumThreads()
public void execute(java.lang.Runnable command)
execute
in interface java.util.concurrent.Executor
public void execute(java.util.concurrent.Callable<?> 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> submit(java.lang.Runnable task, T result)
submit
in interface java.util.concurrent.ExecutorService
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit
in interface java.util.concurrent.ExecutorService
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
public boolean hasNextFuture()
public java.util.concurrent.Future<?> popFuture()