@Override public void execute(Runnable command) { // check if the Runnable was of an unsupported type if (command instanceof ChannelUpstreamEventRunnable) { throw new RejectedExecutionException("command must be enclosed with an downstream event."); } doExecute(command); }
public void operationComplete(ChannelFuture future) throws Exception { removeChildExecutor(key); } });
@Override protected Executor getChildExecutor(ChannelEvent e) { final Object key = getChildExecutorKey(e); Executor executor = childExecutors.get(key); if (executor == null) { executor = new ChildExecutor(); Executor oldExecutor = childExecutors.putIfAbsent(key, executor); if (oldExecutor != null) { executor = oldExecutor; } else { // register a listener so that the ChildExecutor will get removed once the channel was closed e.getChannel().getCloseFuture().addListener(new ChannelFutureListener() { public void operationComplete(ChannelFuture future) throws Exception { removeChildExecutor(key); } }); } } return executor; } }