Class OrderedDownstreamThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor
-
- org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
-
- org.jboss.netty.handler.execution.OrderedDownstreamThreadPoolExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
public final class OrderedDownstreamThreadPoolExecutor extends OrderedMemoryAwareThreadPoolExecutor
Executor
which should be used for downstreamChannelEvent
's. This implementation will take care of preserve the order of the events in aChannel
. If you don't need to preserve the order just use one of theExecutor
implementations provided by the static methods ofExecutors
.
For more informations about how the order is preserved seeOrderedMemoryAwareThreadPoolExecutor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
OrderedMemoryAwareThreadPoolExecutor.ChildExecutor
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
-
Fields inherited from class org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
childExecutors
-
-
Constructor Summary
Constructors Constructor Description OrderedDownstreamThreadPoolExecutor(int corePoolSize)
Creates a new instance.OrderedDownstreamThreadPoolExecutor(int corePoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit)
Creates a new instance.OrderedDownstreamThreadPoolExecutor(int corePoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.ThreadFactory threadFactory)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(java.lang.Runnable command)
protected java.util.concurrent.Executor
getChildExecutor(ChannelEvent e)
long
getMaxChannelMemorySize()
Returns0L
long
getMaxTotalMemorySize()
Returns0L
ObjectSizeEstimator
getObjectSizeEstimator()
Returnnull
void
setMaxChannelMemorySize(long maxChannelMemorySize)
ThrowsUnsupportedOperationException
as there is not support for limit the memory size in this implementationvoid
setObjectSizeEstimator(ObjectSizeEstimator objectSizeEstimator)
ThrowsUnsupportedOperationException
as there is not support for limit the memory size in this implementationprotected boolean
shouldCount(java.lang.Runnable task)
Returnfalse
as we not need to cound the memory in this implementation-
Methods inherited from class org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
doExecute, getChildExecutorKey, getChildExecutorKeySet, newChildExecutorMap, onAfterExecute, removeChildExecutor
-
Methods inherited from class org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor
beforeExecute, decreaseCounter, doUnorderedExecute, getNotifyChannelFuturesOnShutdown, increaseCounter, remove, setNotifyChannelFuturesOnShutdown, shutdownNow, shutdownNow, terminated
-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, toString
-
-
-
-
Constructor Detail
-
OrderedDownstreamThreadPoolExecutor
public OrderedDownstreamThreadPoolExecutor(int corePoolSize)
Creates a new instance.- Parameters:
corePoolSize
- the maximum number of active threads
-
OrderedDownstreamThreadPoolExecutor
public OrderedDownstreamThreadPoolExecutor(int corePoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit)
Creates a new instance.- Parameters:
corePoolSize
- the maximum number of active threadskeepAliveTime
- the amount of time for an inactive thread to shut itself downunit
- theTimeUnit
ofkeepAliveTime
-
OrderedDownstreamThreadPoolExecutor
public OrderedDownstreamThreadPoolExecutor(int corePoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, java.util.concurrent.ThreadFactory threadFactory)
Creates a new instance.- Parameters:
corePoolSize
- the maximum number of active threadskeepAliveTime
- the amount of time for an inactive thread to shut itself downunit
- theTimeUnit
ofkeepAliveTime
threadFactory
- theThreadFactory
of this pool
-
-
Method Detail
-
getObjectSizeEstimator
public ObjectSizeEstimator getObjectSizeEstimator()
Returnnull
- Overrides:
getObjectSizeEstimator
in classMemoryAwareThreadPoolExecutor
-
setObjectSizeEstimator
public void setObjectSizeEstimator(ObjectSizeEstimator objectSizeEstimator)
ThrowsUnsupportedOperationException
as there is not support for limit the memory size in this implementation- Overrides:
setObjectSizeEstimator
in classMemoryAwareThreadPoolExecutor
-
getMaxChannelMemorySize
public long getMaxChannelMemorySize()
Returns0L
- Overrides:
getMaxChannelMemorySize
in classMemoryAwareThreadPoolExecutor
-
setMaxChannelMemorySize
public void setMaxChannelMemorySize(long maxChannelMemorySize)
ThrowsUnsupportedOperationException
as there is not support for limit the memory size in this implementation- Overrides:
setMaxChannelMemorySize
in classMemoryAwareThreadPoolExecutor
-
getMaxTotalMemorySize
public long getMaxTotalMemorySize()
Returns0L
- Overrides:
getMaxTotalMemorySize
in classMemoryAwareThreadPoolExecutor
-
shouldCount
protected boolean shouldCount(java.lang.Runnable task)
Returnfalse
as we not need to cound the memory in this implementation- Overrides:
shouldCount
in classOrderedMemoryAwareThreadPoolExecutor
-
execute
public void execute(java.lang.Runnable command)
- Specified by:
execute
in interfacejava.util.concurrent.Executor
- Overrides:
execute
in classMemoryAwareThreadPoolExecutor
-
getChildExecutor
protected java.util.concurrent.Executor getChildExecutor(ChannelEvent e)
- Overrides:
getChildExecutor
in classOrderedMemoryAwareThreadPoolExecutor
-
-