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
AThreadPoolExecutor
that does not maintain the order ofIoEvent
s. 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 boolean
awaitTermination(long timeout, TimeUnit unit)
void
execute(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()
boolean
remove(Runnable task)
void
setCorePoolSize(int corePoolSize)
void
setMaximumPoolSize(int maximumPoolSize)
void
setRejectedExecutionHandler(RejectedExecutionHandler handler)
void
shutdown()
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:
setRejectedExecutionHandler
in classThreadPoolExecutor
-
getMaximumPoolSize
public int getMaximumPoolSize()
- Overrides:
getMaximumPoolSize
in classThreadPoolExecutor
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
- Overrides:
setMaximumPoolSize
in classThreadPoolExecutor
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfaceExecutorService
- Overrides:
awaitTermination
in classThreadPoolExecutor
- Throws:
InterruptedException
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfaceExecutorService
- Overrides:
isShutdown
in classThreadPoolExecutor
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceExecutorService
- Overrides:
isTerminated
in classThreadPoolExecutor
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceExecutorService
- Overrides:
shutdown
in classThreadPoolExecutor
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNow
in interfaceExecutorService
- Overrides:
shutdownNow
in classThreadPoolExecutor
-
execute
public void execute(Runnable task)
- Specified by:
execute
in interfaceExecutor
- Overrides:
execute
in classThreadPoolExecutor
-
getActiveCount
public int getActiveCount()
- Overrides:
getActiveCount
in classThreadPoolExecutor
-
getCompletedTaskCount
public long getCompletedTaskCount()
- Overrides:
getCompletedTaskCount
in classThreadPoolExecutor
-
getLargestPoolSize
public int getLargestPoolSize()
- Overrides:
getLargestPoolSize
in classThreadPoolExecutor
-
getPoolSize
public int getPoolSize()
- Overrides:
getPoolSize
in classThreadPoolExecutor
-
getTaskCount
public long getTaskCount()
- Overrides:
getTaskCount
in classThreadPoolExecutor
-
isTerminating
public boolean isTerminating()
- Overrides:
isTerminating
in classThreadPoolExecutor
-
prestartAllCoreThreads
public int prestartAllCoreThreads()
- Overrides:
prestartAllCoreThreads
in classThreadPoolExecutor
-
prestartCoreThread
public boolean prestartCoreThread()
- Overrides:
prestartCoreThread
in classThreadPoolExecutor
-
purge
public void purge()
- Overrides:
purge
in classThreadPoolExecutor
-
remove
public boolean remove(Runnable task)
- Overrides:
remove
in classThreadPoolExecutor
-
getCorePoolSize
public int getCorePoolSize()
- Overrides:
getCorePoolSize
in classThreadPoolExecutor
-
setCorePoolSize
public void setCorePoolSize(int corePoolSize)
- Overrides:
setCorePoolSize
in classThreadPoolExecutor
-
-