Package org.apache.mina.common
Class ExecutorThreadModel
java.lang.Object
org.apache.mina.common.ExecutorThreadModel
- All Implemented Interfaces:
IoFilterChainBuilder
,ThreadModel
A
ThreadModel
which represents a thread model with an Executor
per service. The default underlying Executor
is ThreadPoolExecutor
,
so you can safely downcast the returned Executor
of getExecutor()
to
ThreadPoolExecutor
by default.-
Field Summary
Fields inherited from interface org.apache.mina.common.IoFilterChainBuilder
NOOP
Fields inherited from interface org.apache.mina.common.ThreadModel
MANUAL
-
Method Summary
Modifier and TypeMethodDescriptionvoid
buildFilterChain
(IoFilterChain chain) Modifies the specified chain.Returns the underlyingExecutor
of this model.static ExecutorThreadModel
getInstance
(String serviceName) Returns aExecutorThreadModel
instance for the specified serviceName.void
setExecutor
(Executor executor) Changes the underlyingExecutor
of this model.
-
Method Details
-
getInstance
Returns aExecutorThreadModel
instance for the specified serviceName. Please note that all returned instances will be managed globally; the same instance will be returned if you specified the same service name. Please try to specify different names for different services.- Parameters:
serviceName
- the name of the service that needs thread pooling
-
getExecutor
-
setExecutor
Changes the underlyingExecutor
of this model. Previous settings such as the number of threads should be configured again. Only newly createdIoSession
s will be affected.- Parameters:
executor
- null to revert to the default setting
-
buildFilterChain
Description copied from interface:IoFilterChainBuilder
Modifies the specified chain.- Specified by:
buildFilterChain
in interfaceIoFilterChainBuilder
- Throws:
Exception
-