Resolved issue: NETTY-100 Add ExecutionHandler.terminateExecutor()

This commit is contained in:
Trustin Lee 2009-01-02 16:48:11 +00:00
parent 6173181792
commit 4032940e51

View File

@ -29,6 +29,7 @@ import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ChannelUpstreamHandler;
import org.jboss.netty.util.ExecutorShutdownUtil;
/**
* Forwards an upstream {@link ChannelEvent} to an {@link Executor}.
@ -77,10 +78,18 @@ public class ExecutionHandler implements ChannelUpstreamHandler {
/**
* Returns the {@link Executor} which was specified with the constructor.
*/
public final Executor getExecutor() {
public Executor getExecutor() {
return executor;
}
/**
* Shuts down the {@link Executor} which was specified with the constructor
* and wait for its termination.
*/
public void terminateExecutor() {
ExecutorShutdownUtil.shutdown(getExecutor());
}
public void handleUpstream(
ChannelHandlerContext context, ChannelEvent e) throws Exception {
executor.execute(new ChannelEventRunnable(context, e));