@Override public void enableRecv() { if (throttled) { throttled = false; if (LOG.isDebugEnabled()) { LOG.debug("Sending unthrottle event " + this); } channel.getPipeline().sendUpstream(new ResumeMessageEvent(channel)); } }
/** * Sends a {@code "channelDisconnected"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireChannelDisconnected(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.CONNECTED, null)); }
/** * Sends a {@code "channelConnected"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. * * @param remoteAddress * the remote address where the specified channel is connected */ public static void fireChannelConnected(Channel channel, SocketAddress remoteAddress) { channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.CONNECTED, remoteAddress)); }
/** * Sends a {@code "exceptionCaught"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireExceptionCaught(Channel channel, Throwable cause) { channel.getPipeline().sendUpstream( new DefaultExceptionEvent(channel, cause)); }
private static void fireChildChannelStateChanged( Channel channel, Channel childChannel) { channel.getPipeline().sendUpstream( new DefaultChildChannelStateEvent(channel, childChannel)); }
/** * Sends a {@code "writeComplete"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireWriteComplete(Channel channel, long amount) { if (amount == 0) { return; } channel.getPipeline().sendUpstream( new DefaultWriteCompletionEvent(channel, amount)); }
/** * Sends a {@code "channelUnbound"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireChannelUnbound(Channel channel) { channel.getPipeline().sendUpstream(new UpstreamChannelStateEvent( channel, ChannelState.BOUND, null)); }
/** * Sends a {@code "channelInterestChanged"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireChannelInterestChanged(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.INTEREST_OPS, Channel.OP_READ)); }
/** * Sends a {@code "channelBound"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. * * @param localAddress * the local address where the specified channel is bound */ public static void fireChannelBound(Channel channel, SocketAddress localAddress) { channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.BOUND, localAddress)); }
/** * Sends a {@code "messageReceived"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel} belongs. * * @param message the received message * @param remoteAddress the remote address where the received message * came from */ public static void fireMessageReceived(Channel channel, Object message, SocketAddress remoteAddress) { channel.getPipeline().sendUpstream( new UpstreamMessageEvent(channel, message, remoteAddress)); }
private void setUserDefinedWritability(int index) { final int mask = ~writabilityMask(index); for (;;) { final int oldValue = unwritable; final int newValue = oldValue & mask; if (UNWRITABLE_UPDATER.compareAndSet(this, oldValue, newValue)) { if (oldValue != 0 && newValue == 0) { getPipeline().sendUpstream( new UpstreamChannelStateEvent( this, ChannelState.INTEREST_OPS, getInterestOps())); } break; } } }
private void clearUserDefinedWritability(int index) { final int mask = writabilityMask(index); for (;;) { final int oldValue = unwritable; final int newValue = oldValue | mask; if (UNWRITABLE_UPDATER.compareAndSet(this, oldValue, newValue)) { if (oldValue == 0 && newValue != 0) { getPipeline().sendUpstream( new UpstreamChannelStateEvent( this, ChannelState.INTEREST_OPS, getInterestOps())); } break; } } }
/** * Sends a {@code "channelClosed"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireChannelClosed(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.OPEN, Boolean.FALSE)); // Notify the parent handler. if (channel.getParent() != null) { fireChildChannelStateChanged(channel.getParent(), channel); } }
/** * Sends a {@code "channelOpen"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. If the specified channel has a parent, * a {@code "childChannelOpen"} event will be sent, too. */ public static void fireChannelOpen(Channel channel) { // Notify the parent handler. if (channel.getParent() != null) { fireChildChannelStateChanged(channel.getParent(), channel); } channel.getPipeline().sendUpstream( new UpstreamChannelStateEvent( channel, ChannelState.OPEN, Boolean.TRUE)); }
/** * Sends a {@code "shutdownInput"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireInputShutdown(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamShutdownInputEvent(channel)); }
/** * Sends a {@code "shutdownOutput"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireOutputShutdown(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamShutdownOutputEvent(channel)); }
/** * Sends a {@code "flushed"} event to the first * {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of * the specified {@link Channel}. */ public static void fireFlushed(Channel channel) { channel.getPipeline().sendUpstream( new UpstreamFlushEvent(channel)); }
/** * Sends a {@code "shutdownInput"} event to the * {@link ChannelUpstreamHandler} which is placed in the closest upstream * from the handler associated with the specified * {@link ChannelHandlerContext}. */ public static void fireInputShutdown(ChannelHandlerContext ctx) { ctx.getPipeline().sendUpstream( new UpstreamShutdownInputEvent(ctx.getChannel())); }
public static ChannelFuture prepare(Channel channel) { ChannelPipeline pipeline = channel.getPipeline(); ChannelFuture future = future(channel); pipeline.sendUpstream(new UpstreamPreparationEvent(channel, future)); return future; }
public void sendUpstream(Object message) { if (message instanceof ChannelEvent) { this.pipeline.sendUpstream( (ChannelEvent) message ); } else { Channels.fireMessageReceived( this.channel, message ); } }