Package org.apache.mina.filter.executor
Class UnorderedThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.apache.mina.filter.executor.UnorderedThreadPoolExecutor
-
- All Implemented Interfaces:
Executor,ExecutorService
public class UnorderedThreadPoolExecutor extends ThreadPoolExecutor
AThreadPoolExecutorthat does not maintain the order ofIoEvents. 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.- All event handler methods can be called simultaneously. (e.g. messageReceived and messageSent can be invoked at the same time.)
- The event order can be mixed up. (e.g. sessionClosed or messageSent can be invoked before messageReceived is invoked.)
OrderedThreadPoolExecutor.- Author:
- Apache MINA Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description UnorderedThreadPoolExecutor()Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int maximumPoolSize)Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize)Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory)Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, IoEventQueueHandler queueHandler)Creates a new UnorderedThreadPoolExecutor instanceUnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, IoEventQueueHandler queueHandler)Creates a new UnorderedThreadPoolExecutor instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, TimeUnit unit)voidexecute(Runnable task)intgetActiveCount()longgetCompletedTaskCount()intgetCorePoolSize()intgetLargestPoolSize()intgetMaximumPoolSize()intgetPoolSize()IoEventQueueHandlergetQueueHandler()longgetTaskCount()booleanisShutdown()booleanisTerminated()booleanisTerminating()intprestartAllCoreThreads()booleanprestartCoreThread()voidpurge()booleanremove(Runnable task)voidsetCorePoolSize(int corePoolSize)voidsetMaximumPoolSize(int maximumPoolSize)voidsetRejectedExecutionHandler(RejectedExecutionHandler handler)voidshutdown()List<Runnable>shutdownNow()-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, beforeExecute, finalize, getKeepAliveTime, getQueue, getRejectedExecutionHandler, getThreadFactory, setKeepAliveTime, setThreadFactory, terminated, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Constructor Detail
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor()
Creates a new UnorderedThreadPoolExecutor instance
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int maximumPoolSize)
Creates a new UnorderedThreadPoolExecutor instance- Parameters:
maximumPoolSize- The maximum number of threads in the pool
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize)Creates a new UnorderedThreadPoolExecutor instance- Parameters:
corePoolSize- The initial threads pool sizemaximumPoolSize- The maximum number of threads in the pool
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit)Creates a new UnorderedThreadPoolExecutor instance- Parameters:
corePoolSize- The initial threads pool sizemaximumPoolSize- The maximum number of threads in the poolkeepAliveTime- The time to keep threads aliveunit- The time unit for the keepAliveTime
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, IoEventQueueHandler queueHandler)Creates a new UnorderedThreadPoolExecutor instance- Parameters:
corePoolSize- The initial threads pool sizemaximumPoolSize- The maximum number of threads in the poolkeepAliveTime- The time to keep threads aliveunit- The time unit for the keepAliveTimequeueHandler- The Event queue handler to use
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory)Creates a new UnorderedThreadPoolExecutor instance- Parameters:
corePoolSize- The initial threads pool sizemaximumPoolSize- The maximum number of threads in the poolkeepAliveTime- The time to keep threads aliveunit- The time unit for the keepAliveTimethreadFactory- The Thread factory to use
-
UnorderedThreadPoolExecutor
public UnorderedThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, IoEventQueueHandler queueHandler)Creates a new UnorderedThreadPoolExecutor instance- Parameters:
corePoolSize- The initial threads pool sizemaximumPoolSize- The maximum number of threads in the poolkeepAliveTime- The time to keep threads aliveunit- The time unit for the keepAliveTimethreadFactory- The Thread factory to usequeueHandler- The Event queue handler to use
-
-
Method Detail
-
getQueueHandler
public IoEventQueueHandler getQueueHandler()
- Returns:
- The Queue handler in use
-
setRejectedExecutionHandler
public void setRejectedExecutionHandler(RejectedExecutionHandler handler)
- Overrides:
setRejectedExecutionHandlerin classThreadPoolExecutor
-
getMaximumPoolSize
public int getMaximumPoolSize()
- Overrides:
getMaximumPoolSizein classThreadPoolExecutor
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
- Overrides:
setMaximumPoolSizein classThreadPoolExecutor
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Overrides:
awaitTerminationin classThreadPoolExecutor- Throws:
InterruptedException
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService- Overrides:
isShutdownin classThreadPoolExecutor
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService- Overrides:
isTerminatedin classThreadPoolExecutor
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService- Overrides:
shutdownin classThreadPoolExecutor
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorService- Overrides:
shutdownNowin classThreadPoolExecutor
-
execute
public void execute(Runnable task)
- Specified by:
executein interfaceExecutor- Overrides:
executein classThreadPoolExecutor
-
getActiveCount
public int getActiveCount()
- Overrides:
getActiveCountin classThreadPoolExecutor
-
getCompletedTaskCount
public long getCompletedTaskCount()
- Overrides:
getCompletedTaskCountin classThreadPoolExecutor
-
getLargestPoolSize
public int getLargestPoolSize()
- Overrides:
getLargestPoolSizein classThreadPoolExecutor
-
getPoolSize
public int getPoolSize()
- Overrides:
getPoolSizein classThreadPoolExecutor
-
getTaskCount
public long getTaskCount()
- Overrides:
getTaskCountin classThreadPoolExecutor
-
isTerminating
public boolean isTerminating()
- Overrides:
isTerminatingin classThreadPoolExecutor
-
prestartAllCoreThreads
public int prestartAllCoreThreads()
- Overrides:
prestartAllCoreThreadsin classThreadPoolExecutor
-
prestartCoreThread
public boolean prestartCoreThread()
- Overrides:
prestartCoreThreadin classThreadPoolExecutor
-
purge
public void purge()
- Overrides:
purgein classThreadPoolExecutor
-
remove
public boolean remove(Runnable task)
- Overrides:
removein classThreadPoolExecutor
-
getCorePoolSize
public int getCorePoolSize()
- Overrides:
getCorePoolSizein classThreadPoolExecutor
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
- Overrides:
setCorePoolSizein classThreadPoolExecutor
-
-