public class OrderedThreadPoolExecutor extends ThreadPoolExecutor
ThreadPoolExecutor
that maintains the order of IoEvent
s.
If you don't need to maintain the order of events per session, please use
UnorderedThreadPoolExecutor
.
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
OrderedThreadPoolExecutor()
Creates a default ThreadPool, with default values :
- minimum pool size is 0
- maximum pool size is 16
- keepAlive set to 30 seconds
- A default ThreadFactory
- All events are accepted
|
OrderedThreadPoolExecutor(int maximumPoolSize)
Creates a default ThreadPool, with default values :
- minimum pool size is 0
- keepAlive set to 30 seconds
- A default ThreadFactory
- All events are accepted
|
OrderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize)
Creates a default ThreadPool, with default values :
- keepAlive set to 30 seconds
- A default ThreadFactory
- All events are accepted
|
OrderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit)
Creates a default ThreadPool, with default values :
- A default ThreadFactory
- All events are accepted
|
OrderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
IoEventQueueHandler eventQueueHandler)
Creates a default ThreadPool, with default values :
- A default ThreadFactory
|
OrderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
ThreadFactory threadFactory)
Creates a default ThreadPool, with default values :
- A default ThreadFactory
|
OrderedThreadPoolExecutor(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit,
ThreadFactory threadFactory,
IoEventQueueHandler eventQueueHandler)
Creates a new instance of a OrderedThreadPoolExecutor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable task) |
int |
getActiveCount() |
long |
getCompletedTaskCount() |
int |
getCorePoolSize() |
int |
getLargestPoolSize() |
int |
getMaximumPoolSize() |
int |
getPoolSize() |
BlockingQueue<Runnable> |
getQueue() |
IoEventQueueHandler |
getQueueHandler() |
long |
getTaskCount() |
boolean |
isShutdown() |
boolean |
isTerminated() |
boolean |
isTerminating() |
int |
prestartAllCoreThreads() |
boolean |
prestartCoreThread() |
void |
purge() |
boolean |
remove(Runnable task) |
void |
setCorePoolSize(int corePoolSize) |
void |
setMaximumPoolSize(int maximumPoolSize) |
void |
setRejectedExecutionHandler(RejectedExecutionHandler handler) |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, beforeExecute, finalize, getKeepAliveTime, getRejectedExecutionHandler, getThreadFactory, setKeepAliveTime, setThreadFactory, terminated, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public OrderedThreadPoolExecutor()
public OrderedThreadPoolExecutor(int maximumPoolSize)
maximumPoolSize
- The maximum pool sizepublic OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize)
corePoolSize
- The initial pool sizePoolSizemaximumPoolSize
- The maximum pool sizepublic OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)
corePoolSize
- The initial pool sizePoolSizemaximumPoolSize
- The maximum pool sizekeepAliveTime
- Default duration for a threadunit
- Time unit used for the keepAlive valuepublic OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, IoEventQueueHandler eventQueueHandler)
corePoolSize
- The initial pool sizePoolSizemaximumPoolSize
- The maximum pool sizekeepAliveTime
- Default duration for a threadunit
- Time unit used for the keepAlive valueeventQueueHandler
- The queue used to store eventspublic OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory)
corePoolSize
- The initial pool sizePoolSizemaximumPoolSize
- The maximum pool sizekeepAliveTime
- Default duration for a threadunit
- Time unit used for the keepAlive valuethreadFactory
- The factory used to create threadspublic OrderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, IoEventQueueHandler eventQueueHandler)
corePoolSize
- The initial pool sizePoolSizemaximumPoolSize
- The maximum pool sizekeepAliveTime
- Default duration for a threadunit
- Time unit used for the keepAlive valuethreadFactory
- The factory used to create threadseventQueueHandler
- The queue used to store eventspublic IoEventQueueHandler getQueueHandler()
public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
setRejectedExecutionHandler
in class ThreadPoolExecutor
public int getMaximumPoolSize()
getMaximumPoolSize
in class ThreadPoolExecutor
public void setMaximumPoolSize(int maximumPoolSize)
setMaximumPoolSize
in class ThreadPoolExecutor
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
awaitTermination
in class ThreadPoolExecutor
InterruptedException
public boolean isShutdown()
isShutdown
in interface ExecutorService
isShutdown
in class ThreadPoolExecutor
public boolean isTerminated()
isTerminated
in interface ExecutorService
isTerminated
in class ThreadPoolExecutor
public void shutdown()
shutdown
in interface ExecutorService
shutdown
in class ThreadPoolExecutor
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
shutdownNow
in class ThreadPoolExecutor
public void execute(Runnable task)
execute
in interface Executor
execute
in class ThreadPoolExecutor
public int getActiveCount()
getActiveCount
in class ThreadPoolExecutor
public long getCompletedTaskCount()
getCompletedTaskCount
in class ThreadPoolExecutor
public int getLargestPoolSize()
getLargestPoolSize
in class ThreadPoolExecutor
public int getPoolSize()
getPoolSize
in class ThreadPoolExecutor
public long getTaskCount()
getTaskCount
in class ThreadPoolExecutor
public boolean isTerminating()
isTerminating
in class ThreadPoolExecutor
public int prestartAllCoreThreads()
prestartAllCoreThreads
in class ThreadPoolExecutor
public boolean prestartCoreThread()
prestartCoreThread
in class ThreadPoolExecutor
public BlockingQueue<Runnable> getQueue()
getQueue
in class ThreadPoolExecutor
public void purge()
purge
in class ThreadPoolExecutor
public boolean remove(Runnable task)
remove
in class ThreadPoolExecutor
public int getCorePoolSize()
getCorePoolSize
in class ThreadPoolExecutor
public void setCorePoolSize(int corePoolSize)
setCorePoolSize
in class ThreadPoolExecutor
Copyright © 2004–2016 Apache MINA Project. All rights reserved.