public class UnorderedThreadPoolExecutor
extends java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor that does not maintain the order of IoEvents.
This means more than one event handler methods can be invoked at the same
time with mixed order. For example, let's assume that messageReceived, messageSent,
and sessionClosed events are fired.
OrderedThreadPoolExecutor.| Modifier and Type | Class and Description |
|---|---|
private class |
UnorderedThreadPoolExecutor.Worker |
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy| Modifier and Type | Field and Description |
|---|---|
private long |
completedTaskCount |
private int |
corePoolSize |
private static java.lang.Runnable |
EXIT_SIGNAL |
private java.util.concurrent.atomic.AtomicInteger |
idleWorkers |
private int |
largestPoolSize |
private int |
maximumPoolSize |
private IoEventQueueHandler |
queueHandler |
private boolean |
shutdown |
private java.util.Set<UnorderedThreadPoolExecutor.Worker> |
workers |
| Constructor and Description |
|---|
UnorderedThreadPoolExecutor() |
UnorderedThreadPoolExecutor(int maximumPoolSize) |
UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize) |
UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit) |
UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
IoEventQueueHandler queueHandler) |
UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ThreadFactory threadFactory) |
UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ThreadFactory threadFactory,
IoEventQueueHandler queueHandler) |
| Modifier and Type | Method and Description |
|---|---|
private void |
addWorker() |
private void |
addWorkerIfNecessary() |
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
private void |
checkTaskType(java.lang.Runnable task) |
void |
execute(java.lang.Runnable task) |
int |
getActiveCount() |
long |
getCompletedTaskCount() |
int |
getCorePoolSize() |
int |
getLargestPoolSize() |
int |
getMaximumPoolSize() |
int |
getPoolSize() |
IoEventQueueHandler |
getQueueHandler() |
long |
getTaskCount() |
boolean |
isShutdown() |
boolean |
isTerminated() |
boolean |
isTerminating() |
int |
prestartAllCoreThreads() |
boolean |
prestartCoreThread() |
void |
purge() |
private void |
rejectTask(java.lang.Runnable task) |
boolean |
remove(java.lang.Runnable task) |
private void |
removeWorker() |
void |
setCorePoolSize(int corePoolSize) |
void |
setMaximumPoolSize(int maximumPoolSize) |
void |
setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler) |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, beforeExecute, finalize, getKeepAliveTime, getQueue, getRejectedExecutionHandler, getThreadFactory, setKeepAliveTime, setThreadFactory, terminated, toStringprivate static final java.lang.Runnable EXIT_SIGNAL
private final java.util.Set<UnorderedThreadPoolExecutor.Worker> workers
private volatile int corePoolSize
private volatile int maximumPoolSize
private volatile int largestPoolSize
private final java.util.concurrent.atomic.AtomicInteger idleWorkers
private long completedTaskCount
private volatile boolean shutdown
private final IoEventQueueHandler queueHandler
public UnorderedThreadPoolExecutor()
public UnorderedThreadPoolExecutor(int maximumPoolSize)
public UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize)
public UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit)
public UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
IoEventQueueHandler queueHandler)
public UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ThreadFactory threadFactory)
public UnorderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.TimeUnit unit,
java.util.concurrent.ThreadFactory threadFactory,
IoEventQueueHandler queueHandler)
public IoEventQueueHandler getQueueHandler()
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)
setRejectedExecutionHandler in class java.util.concurrent.ThreadPoolExecutorprivate void addWorker()
private void addWorkerIfNecessary()
private void removeWorker()
public int getMaximumPoolSize()
getMaximumPoolSize in class java.util.concurrent.ThreadPoolExecutorpublic void setMaximumPoolSize(int maximumPoolSize)
setMaximumPoolSize in class java.util.concurrent.ThreadPoolExecutorpublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServiceawaitTermination in class java.util.concurrent.ThreadPoolExecutorjava.lang.InterruptedExceptionpublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServiceisShutdown in class java.util.concurrent.ThreadPoolExecutorpublic boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServiceisTerminated in class java.util.concurrent.ThreadPoolExecutorpublic void shutdown()
shutdown in interface java.util.concurrent.ExecutorServiceshutdown in class java.util.concurrent.ThreadPoolExecutorpublic java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow in interface java.util.concurrent.ExecutorServiceshutdownNow in class java.util.concurrent.ThreadPoolExecutorpublic void execute(java.lang.Runnable task)
execute in interface java.util.concurrent.Executorexecute in class java.util.concurrent.ThreadPoolExecutorprivate void rejectTask(java.lang.Runnable task)
private void checkTaskType(java.lang.Runnable task)
public int getActiveCount()
getActiveCount in class java.util.concurrent.ThreadPoolExecutorpublic long getCompletedTaskCount()
getCompletedTaskCount in class java.util.concurrent.ThreadPoolExecutorpublic int getLargestPoolSize()
getLargestPoolSize in class java.util.concurrent.ThreadPoolExecutorpublic int getPoolSize()
getPoolSize in class java.util.concurrent.ThreadPoolExecutorpublic long getTaskCount()
getTaskCount in class java.util.concurrent.ThreadPoolExecutorpublic boolean isTerminating()
isTerminating in class java.util.concurrent.ThreadPoolExecutorpublic int prestartAllCoreThreads()
prestartAllCoreThreads in class java.util.concurrent.ThreadPoolExecutorpublic boolean prestartCoreThread()
prestartCoreThread in class java.util.concurrent.ThreadPoolExecutorpublic void purge()
purge in class java.util.concurrent.ThreadPoolExecutorpublic boolean remove(java.lang.Runnable task)
remove in class java.util.concurrent.ThreadPoolExecutorpublic int getCorePoolSize()
getCorePoolSize in class java.util.concurrent.ThreadPoolExecutorpublic void setCorePoolSize(int corePoolSize)
setCorePoolSize in class java.util.concurrent.ThreadPoolExecutor