From 4032940e514521c854ce17a19e5cf5af80729e42 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Fri, 2 Jan 2009 16:48:11 +0000 Subject: [PATCH] Resolved issue: NETTY-100 Add ExecutionHandler.terminateExecutor() --- .../netty/handler/execution/ExecutionHandler.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java index c7edd7edfb..9a99bc036a 100644 --- a/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java +++ b/src/main/java/org/jboss/netty/handler/execution/ExecutionHandler.java @@ -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));