Class ChainedExecutor
- java.lang.Object
-
- org.jboss.netty.handler.execution.ChainedExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor
,ExternalResourceReleasable
public class ChainedExecutor extends java.lang.Object implements java.util.concurrent.Executor, ExternalResourceReleasable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.Executor
cur
private ChannelEventRunnableFilter
filter
private java.util.concurrent.Executor
next
-
Constructor Summary
Constructors Constructor Description ChainedExecutor(ChannelEventRunnableFilter filter, java.util.concurrent.Executor cur, java.util.concurrent.Executor next)
Create a newChainedExecutor
which will used the givenChannelEventRunnableFilter
to see if thecur
Executor
should get used.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(java.lang.Runnable command)
Execute the passedChannelEventRunnable
with the currentExecutor
if theChannelEventRunnableFilter
match.private static void
releaseExternal(java.util.concurrent.Executor executor)
void
releaseExternalResources()
Releases the external resources that this object depends on.
-
-
-
Field Detail
-
cur
private final java.util.concurrent.Executor cur
-
next
private final java.util.concurrent.Executor next
-
filter
private final ChannelEventRunnableFilter filter
-
-
Constructor Detail
-
ChainedExecutor
public ChainedExecutor(ChannelEventRunnableFilter filter, java.util.concurrent.Executor cur, java.util.concurrent.Executor next)
Create a newChainedExecutor
which will used the givenChannelEventRunnableFilter
to see if thecur
Executor
should get used. Otherwise it will pass the work to thenext
Executor
- Parameters:
filter
- theChannelEventRunnableFilter
which will be used to check if theChannelEventRunnable
should be passed to the cur or nextExecutor
cur
- theExecutor
to use if theChannelEventRunnableFilter
matchnext
- theExecutor
to use if theChannelEventRunnableFilter
does not match
-
-
Method Detail
-
execute
public void execute(java.lang.Runnable command)
Execute the passedChannelEventRunnable
with the currentExecutor
if theChannelEventRunnableFilter
match. Otherwise pass it to the nextExecutor
in the chain.- Specified by:
execute
in interfacejava.util.concurrent.Executor
-
releaseExternalResources
public void releaseExternalResources()
Description copied from interface:ExternalResourceReleasable
Releases the external resources that this object depends on. You should not call this method if the external resources (e.g. thread pool) are in use by other objects.- Specified by:
releaseExternalResources
in interfaceExternalResourceReleasable
-
releaseExternal
private static void releaseExternal(java.util.concurrent.Executor executor)
-
-