public class ThreadPoolExecutorDispatcher extends AbstractMultiThreadDispatcher
Dispatcher that uses a ThreadPoolExecutor with an unbounded queue to dispatch events.AbstractMultiThreadDispatcher.MultiThreadTaskAbstractLifecycleDispatcher.Task| Constructor and Description |
|---|
ThreadPoolExecutorDispatcher(int poolSize,
int backlog)
Creates a new ThreadPoolExecutorDispatcher with the given poolSize and backlog.
|
ThreadPoolExecutorDispatcher(int backlog,
int poolSize,
java.util.concurrent.ExecutorService executor)
Create a new ThreadPoolTaskExecutor with the given backlog and
ExecutorService. |
ThreadPoolExecutorDispatcher(int poolSize,
int backlog,
java.lang.String threadName)
Create a new ThreadPoolExecutorDispatcher with the given size, backlog, name, and
RejectedExecutionHandler. |
ThreadPoolExecutorDispatcher(int poolSize,
int backlog,
java.lang.String threadName,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Create a new ThreadPoolExecutorDispatcher with the given size, backlog, name, and
RejectedExecutionHandler. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitAndShutdown(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Block until all submitted tasks have completed, then do a normal
Dispatcher.shutdown(). |
protected void |
execute(AbstractLifecycleDispatcher.Task task) |
void |
execute(java.lang.Runnable command) |
void |
halt()
Shutdown this
Dispatcher, forcibly halting any tasks currently executing and discarding any tasks that have
not yet been exected. |
void |
shutdown()
Shutdown this
Dispatcher such that it can no longer be used. |
addToTailRecursionPile, allocateRecursiveTask, allocateTask, getBacklogalive, awaitAndShutdown, dispatch, dispatch, getContext, isInContext, routepublic ThreadPoolExecutorDispatcher(int poolSize,
int backlog)
RejectedExecutionHandler is created which runs the submitted Runnable in the calling thread. To change this behavior, specify your own.poolSize - the pool sizebacklog - the backlog sizepublic ThreadPoolExecutorDispatcher(int poolSize,
int backlog,
java.lang.String threadName)
RejectedExecutionHandler.poolSize - the pool sizebacklog - the backlog sizethreadName - the name prefix to use when creating threadspublic ThreadPoolExecutorDispatcher(int poolSize,
int backlog,
java.lang.String threadName,
java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
RejectedExecutionHandler.poolSize - the pool sizebacklog - the backlog sizethreadName - the name prefix to use when creating threadsrejectedExecutionHandler - the RejectedExecutionHandler to use when jobs can't be submitted to the thread poolpublic ThreadPoolExecutorDispatcher(int backlog,
int poolSize,
java.util.concurrent.ExecutorService executor)
ExecutorService.backlog - the task backlogpoolSize - the number of threadsexecutor - the executor to use to execute taskspublic boolean awaitAndShutdown(long timeout,
java.util.concurrent.TimeUnit timeUnit)
DispatcherDispatcher.shutdown().public void shutdown()
DispatcherDispatcher such that it can no longer be used.shutdown in interface Dispatchershutdown in class AbstractLifecycleDispatcherpublic void halt()
DispatcherDispatcher, forcibly halting any tasks currently executing and discarding any tasks that have
not yet been exected.halt in interface Dispatcherhalt in class AbstractLifecycleDispatcherprotected void execute(AbstractLifecycleDispatcher.Task task)
execute in class AbstractLifecycleDispatcherpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorexecute in class AbstractLifecycleDispatcher