import org.jboss.netty.channel.ChannelEvent; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.util.EstimatableObjectWrapper; public class DownStreamChannelEventRunnable implements Runnable, EstimatableObjectWrapper { private final ChannelHandlerContext ctx; private final ChannelEvent e; /** * Creates a {@link Runnable} which sends the specified {@link ChannelEvent} * downstream via the specified {@link ChannelHandlerContext}. */ public DownStreamChannelEventRunnable(ChannelHandlerContext ctx, ChannelEvent e) { this.ctx = ctx; this.e = e; } /** * Returns the {@link ChannelHandlerContext} which will be used to send the * {@link ChannelEvent} downstream. */ public ChannelHandlerContext getContext() { return ctx; } /** * Returns the {@link ChannelEvent} which will be sent downstream. */ public ChannelEvent getEvent() { return e; } /** * Sends the event downstream. */ public void run() { ctx.sendDownstream(e); } public Object unwrap() { return e; } }