Package org.jboss.netty.channel
Class Channels
- java.lang.Object
-
- org.jboss.netty.channel.Channels
-
public final class Channels extends java.lang.ObjectA helper class which provides various convenience methods related withChannel,ChannelHandler, andChannelPipeline.Factory methods
It is always recommended to use the factory methods provided by
Channelsrather than calling the constructor of the implementation types.pipeline()pipeline(ChannelPipeline)pipelineFactory(ChannelPipeline)succeededFuture(Channel)failedFuture(Channel, Throwable)
Upstream and downstream event generation
Various event generation methods are provided to simplify the generation of upstream events and downstream events. It is always recommended to use the event generation methods provided by
Channelsrather than callingChannelHandlerContext.sendUpstream(ChannelEvent)orChannelHandlerContext.sendDownstream(ChannelEvent)by yourself.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateChannels()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbind(ChannelHandlerContext ctx, ChannelFuture future, java.net.SocketAddress localAddress)Sends a"bind"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturebind(Channel channel, java.net.SocketAddress localAddress)Sends a"bind"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFutureclose(Channel channel)Sends a"close"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static voidclose(ChannelHandlerContext ctx, ChannelFuture future)Sends a"close"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static voidconnect(ChannelHandlerContext ctx, ChannelFuture future, java.net.SocketAddress remoteAddress)Sends a"connect"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFutureconnect(Channel channel, java.net.SocketAddress remoteAddress)Sends a"connect"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFuturedisconnect(Channel channel)Sends a"disconnect"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static voiddisconnect(ChannelHandlerContext ctx, ChannelFuture future)Sends a"disconnect"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturefailedFuture(Channel channel, java.lang.Throwable cause)Creates a newChannelFuturewhich has failed already for the specifiedChannel.private static intfilterDownstreamInterestOps(int interestOps)static voidfireChannelBound(ChannelHandlerContext ctx, java.net.SocketAddress localAddress)Sends a"channelBound"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireChannelBound(Channel channel, java.net.SocketAddress localAddress)Sends a"channelBound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelClosed(Channel channel)Sends a"channelClosed"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelClosed(ChannelHandlerContext ctx)Sends a"channelClosed"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturefireChannelClosedLater(Channel channel)Sends a"channelClosed"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.static voidfireChannelConnected(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress)Sends a"channelConnected"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireChannelConnected(Channel channel, java.net.SocketAddress remoteAddress)Sends a"channelConnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelDisconnected(Channel channel)Sends a"channelDisconnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelDisconnected(ChannelHandlerContext ctx)Sends a"channelDisconnected"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturefireChannelDisconnectedLater(Channel channel)Sends a"channelDisconnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.static voidfireChannelInterestChanged(Channel channel)Sends a"channelInterestChanged"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelInterestChanged(ChannelHandlerContext ctx)Sends a"channelInterestChanged"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturefireChannelInterestChangedLater(Channel channel)Sends a"channelInterestChanged"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.static voidfireChannelOpen(Channel channel)Sends a"channelOpen"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelOpen(ChannelHandlerContext ctx)Sends a"channelOpen"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireChannelUnbound(Channel channel)Sends a"channelUnbound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireChannelUnbound(ChannelHandlerContext ctx)Sends a"channelUnbound"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturefireChannelUnboundLater(Channel channel)Sends a"channelUnbound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.private static voidfireChildChannelStateChanged(Channel channel, Channel childChannel)static voidfireExceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause)Sends a"exceptionCaught"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireExceptionCaught(Channel channel, java.lang.Throwable cause)Sends a"exceptionCaught"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFuturefireExceptionCaughtLater(ChannelHandlerContext ctx, java.lang.Throwable cause)Sends a"exceptionCaught"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContextonce the io-thread runs again.static ChannelFuturefireExceptionCaughtLater(Channel channel, java.lang.Throwable cause)Sends a"exceptionCaught"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.static voidfireMessageReceived(ChannelHandlerContext ctx, java.lang.Object message)Sends a"messageReceived"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireMessageReceived(ChannelHandlerContext ctx, java.lang.Object message, java.net.SocketAddress remoteAddress)Sends a"messageReceived"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireMessageReceived(Channel channel, java.lang.Object message)Sends a"messageReceived"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static voidfireMessageReceived(Channel channel, java.lang.Object message, java.net.SocketAddress remoteAddress)Sends a"messageReceived"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelbelongs.static voidfireWriteComplete(ChannelHandlerContext ctx, long amount)Sends a"writeComplete"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.static voidfireWriteComplete(Channel channel, long amount)Sends a"writeComplete"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFuturefireWriteCompleteLater(Channel channel, long amount)Sends a"writeComplete"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelin the next io-thread.static ChannelFuturefuture(Channel channel)Creates a new non-cancellableChannelFuturefor the specifiedChannel.static ChannelFuturefuture(Channel channel, boolean cancellable)Creates a newChannelFuturefor the specifiedChannel.static ChannelPipelinepipeline()Creates a newChannelPipeline.static ChannelPipelinepipeline(ChannelHandler... handlers)Creates a newChannelPipelinewhich contains the specifiedChannelHandlers.static ChannelPipelinepipeline(ChannelPipeline pipeline)Creates a newChannelPipelinewhich contains the same entries with the specifiedpipeline.static ChannelPipelineFactorypipelineFactory(ChannelPipeline pipeline)Creates a newChannelPipelineFactorywhich creates a newChannelPipelinewhich contains the same entries with the specifiedpipeline.static voidsetInterestOps(ChannelHandlerContext ctx, ChannelFuture future, int interestOps)Sends a"setInterestOps"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturesetInterestOps(Channel channel, int interestOps)Sends a"setInterestOps"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFuturesucceededFuture(Channel channel)Creates a newChannelFuturewhich is already succeeded for the specifiedChannel.static ChannelFutureunbind(Channel channel)Sends a"unbind"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static voidunbind(ChannelHandlerContext ctx, ChannelFuture future)Sends a"unbind"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.private static voidvalidateInterestOps(int interestOps)static voidwrite(ChannelHandlerContext ctx, ChannelFuture future, java.lang.Object message)Sends a"write"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static voidwrite(ChannelHandlerContext ctx, ChannelFuture future, java.lang.Object message, java.net.SocketAddress remoteAddress)Sends a"write"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.static ChannelFuturewrite(Channel channel, java.lang.Object message)Sends a"write"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.static ChannelFuturewrite(Channel channel, java.lang.Object message, java.net.SocketAddress remoteAddress)Sends a"write"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.
-
-
-
Method Detail
-
pipeline
public static ChannelPipeline pipeline()
Creates a newChannelPipeline.
-
pipeline
public static ChannelPipeline pipeline(ChannelHandler... handlers)
Creates a newChannelPipelinewhich contains the specifiedChannelHandlers. The names of the specified handlers are generated automatically; the first handler's name is"0", the second handler's name is"1", the third handler's name is"2", and so on.
-
pipeline
public static ChannelPipeline pipeline(ChannelPipeline pipeline)
Creates a newChannelPipelinewhich contains the same entries with the specifiedpipeline. Please note that only the names and the references of theChannelHandlers will be copied; a newChannelHandlerinstance will never be created.
-
pipelineFactory
public static ChannelPipelineFactory pipelineFactory(ChannelPipeline pipeline)
Creates a newChannelPipelineFactorywhich creates a newChannelPipelinewhich contains the same entries with the specifiedpipeline. Please note that only the names and the references of theChannelHandlers will be copied; a newChannelHandlerinstance will never be created.
-
future
public static ChannelFuture future(Channel channel)
Creates a new non-cancellableChannelFuturefor the specifiedChannel.
-
future
public static ChannelFuture future(Channel channel, boolean cancellable)
Creates a newChannelFuturefor the specifiedChannel.- Parameters:
cancellable-trueif and only if the returned future can be canceled byChannelFuture.cancel()
-
succeededFuture
public static ChannelFuture succeededFuture(Channel channel)
Creates a newChannelFuturewhich is already succeeded for the specifiedChannel.
-
failedFuture
public static ChannelFuture failedFuture(Channel channel, java.lang.Throwable cause)
Creates a newChannelFuturewhich has failed already for the specifiedChannel.- Parameters:
cause- the cause of the failure
-
fireChannelOpen
public static void fireChannelOpen(Channel channel)
Sends a"channelOpen"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel. If the specified channel has a parent, a"childChannelOpen"event will be sent, too.
-
fireChannelOpen
public static void fireChannelOpen(ChannelHandlerContext ctx)
Sends a"channelOpen"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.Please note that this method does not trigger a
"childChannelOpen"event unlikefireChannelOpen(Channel)method.
-
fireChannelBound
public static void fireChannelBound(Channel channel, java.net.SocketAddress localAddress)
Sends a"channelBound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
localAddress- the local address where the specified channel is bound
-
fireChannelBound
public static void fireChannelBound(ChannelHandlerContext ctx, java.net.SocketAddress localAddress)
Sends a"channelBound"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
localAddress- the local address where the specified channel is bound
-
fireChannelConnected
public static void fireChannelConnected(Channel channel, java.net.SocketAddress remoteAddress)
Sends a"channelConnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
remoteAddress- the remote address where the specified channel is connected
-
fireChannelConnected
public static void fireChannelConnected(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress)
Sends a"channelConnected"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
remoteAddress- the remote address where the specified channel is connected
-
fireMessageReceived
public static void fireMessageReceived(Channel channel, java.lang.Object message)
Sends a"messageReceived"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
message- the received message
-
fireMessageReceived
public static void fireMessageReceived(Channel channel, java.lang.Object message, java.net.SocketAddress remoteAddress)
Sends a"messageReceived"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelbelongs.- Parameters:
message- the received messageremoteAddress- the remote address where the received message came from
-
fireMessageReceived
public static void fireMessageReceived(ChannelHandlerContext ctx, java.lang.Object message)
Sends a"messageReceived"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
message- the received message
-
fireMessageReceived
public static void fireMessageReceived(ChannelHandlerContext ctx, java.lang.Object message, java.net.SocketAddress remoteAddress)
Sends a"messageReceived"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
message- the received messageremoteAddress- the remote address where the received message came from
-
fireWriteCompleteLater
public static ChannelFuture fireWriteCompleteLater(Channel channel, long amount)
Sends a"writeComplete"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelin the next io-thread.
-
fireWriteComplete
public static void fireWriteComplete(Channel channel, long amount)
Sends a"writeComplete"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireWriteComplete
public static void fireWriteComplete(ChannelHandlerContext ctx, long amount)
Sends a"writeComplete"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireChannelInterestChangedLater
public static ChannelFuture fireChannelInterestChangedLater(Channel channel)
Sends a"channelInterestChanged"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.
-
fireChannelInterestChanged
public static void fireChannelInterestChanged(Channel channel)
Sends a"channelInterestChanged"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireChannelInterestChanged
public static void fireChannelInterestChanged(ChannelHandlerContext ctx)
Sends a"channelInterestChanged"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireChannelDisconnectedLater
public static ChannelFuture fireChannelDisconnectedLater(Channel channel)
Sends a"channelDisconnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.
-
fireChannelDisconnected
public static void fireChannelDisconnected(Channel channel)
Sends a"channelDisconnected"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireChannelDisconnected
public static void fireChannelDisconnected(ChannelHandlerContext ctx)
Sends a"channelDisconnected"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireChannelUnboundLater
public static ChannelFuture fireChannelUnboundLater(Channel channel)
Sends a"channelUnbound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.
-
fireChannelUnbound
public static void fireChannelUnbound(Channel channel)
Sends a"channelUnbound"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireChannelUnbound
public static void fireChannelUnbound(ChannelHandlerContext ctx)
Sends a"channelUnbound"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireChannelClosedLater
public static ChannelFuture fireChannelClosedLater(Channel channel)
Sends a"channelClosed"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.
-
fireChannelClosed
public static void fireChannelClosed(Channel channel)
Sends a"channelClosed"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireChannelClosed
public static void fireChannelClosed(ChannelHandlerContext ctx)
Sends a"channelClosed"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireExceptionCaughtLater
public static ChannelFuture fireExceptionCaughtLater(Channel channel, java.lang.Throwable cause)
Sends a"exceptionCaught"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannelonce the io-thread runs again.
-
fireExceptionCaughtLater
public static ChannelFuture fireExceptionCaughtLater(ChannelHandlerContext ctx, java.lang.Throwable cause)
Sends a"exceptionCaught"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContextonce the io-thread runs again.
-
fireExceptionCaught
public static void fireExceptionCaught(Channel channel, java.lang.Throwable cause)
Sends a"exceptionCaught"event to the firstChannelUpstreamHandlerin theChannelPipelineof the specifiedChannel.
-
fireExceptionCaught
public static void fireExceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause)
Sends a"exceptionCaught"event to theChannelUpstreamHandlerwhich is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext.
-
fireChildChannelStateChanged
private static void fireChildChannelStateChanged(Channel channel, Channel childChannel)
-
bind
public static ChannelFuture bind(Channel channel, java.net.SocketAddress localAddress)
Sends a"bind"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to bindlocalAddress- the local address to bind to- Returns:
- the
ChannelFuturewhich will be notified when the bind operation is done
-
bind
public static void bind(ChannelHandlerContext ctx, ChannelFuture future, java.net.SocketAddress localAddress)
Sends a"bind"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the bind operation is donelocalAddress- the local address to bind to
-
unbind
public static void unbind(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"unbind"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the unbind operation is done
-
unbind
public static ChannelFuture unbind(Channel channel)
Sends a"unbind"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to unbind- Returns:
- the
ChannelFuturewhich will be notified when the unbind operation is done
-
connect
public static ChannelFuture connect(Channel channel, java.net.SocketAddress remoteAddress)
Sends a"connect"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to attempt a connectionremoteAddress- the remote address to connect to- Returns:
- the
ChannelFuturewhich will be notified when the connection attempt is done
-
connect
public static void connect(ChannelHandlerContext ctx, ChannelFuture future, java.net.SocketAddress remoteAddress)
Sends a"connect"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the connection attempt is doneremoteAddress- the remote address to connect to
-
write
public static ChannelFuture write(Channel channel, java.lang.Object message)
Sends a"write"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to write a messagemessage- the message to write to the channel- Returns:
- the
ChannelFuturewhich will be notified when the write operation is done
-
write
public static void write(ChannelHandlerContext ctx, ChannelFuture future, java.lang.Object message)
Sends a"write"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the write operation is done
-
write
public static ChannelFuture write(Channel channel, java.lang.Object message, java.net.SocketAddress remoteAddress)
Sends a"write"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to write a messagemessage- the message to write to the channelremoteAddress- the destination of the message.nullto use the default remote address- Returns:
- the
ChannelFuturewhich will be notified when the write operation is done
-
write
public static void write(ChannelHandlerContext ctx, ChannelFuture future, java.lang.Object message, java.net.SocketAddress remoteAddress)
Sends a"write"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the write operation is donemessage- the message to write to the channelremoteAddress- the destination of the message.nullto use the default remote address.
-
setInterestOps
public static ChannelFuture setInterestOps(Channel channel, int interestOps)
Sends a"setInterestOps"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to change its interestOpsinterestOps- the new interestOps- Returns:
- the
ChannelFuturewhich will be notified when the interestOps is changed
-
setInterestOps
public static void setInterestOps(ChannelHandlerContext ctx, ChannelFuture future, int interestOps)
Sends a"setInterestOps"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified when the interestOps is changed.
-
disconnect
public static ChannelFuture disconnect(Channel channel)
Sends a"disconnect"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to disconnect- Returns:
- the
ChannelFuturewhich will be notified on disconnection
-
disconnect
public static void disconnect(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"disconnect"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified on disconnection
-
close
public static ChannelFuture close(Channel channel)
Sends a"close"request to the lastChannelDownstreamHandlerin theChannelPipelineof the specifiedChannel.- Parameters:
channel- the channel to close- Returns:
- the
ChannelFuturewhich will be notified on closure
-
close
public static void close(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"close"request to theChannelDownstreamHandlerwhich is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext.- Parameters:
ctx- the contextfuture- the future which will be notified on closure
-
validateInterestOps
private static void validateInterestOps(int interestOps)
-
filterDownstreamInterestOps
private static int filterDownstreamInterestOps(int interestOps)
-
-