Package org.jboss.netty.channel
Class Channels
- java.lang.Object
-
- org.jboss.netty.channel.Channels
-
public final class Channels extends Object
A helper class which provides various convenience methods related withChannel
,ChannelHandler
, andChannelPipeline
.Factory methods
It is always recommended to use the factory methods provided by
Channels
rather 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
Channels
rather than callingChannelHandlerContext.sendUpstream(ChannelEvent)
orChannelHandlerContext.sendDownstream(ChannelEvent)
by yourself.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bind(ChannelHandlerContext ctx, ChannelFuture future, SocketAddress localAddress)
Sends a"bind"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
bind(Channel channel, SocketAddress localAddress)
Sends a"bind"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
close(Channel channel)
Sends a"close"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
close(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"close"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static void
connect(ChannelHandlerContext ctx, ChannelFuture future, SocketAddress remoteAddress)
Sends a"connect"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
connect(Channel channel, SocketAddress remoteAddress)
Sends a"connect"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
disconnect(Channel channel)
Sends a"disconnect"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
disconnect(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"disconnect"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
failedFuture(Channel channel, Throwable cause)
Creates a newChannelFuture
which has failed already for the specifiedChannel
.static void
fireChannelBound(ChannelHandlerContext ctx, SocketAddress localAddress)
Sends a"channelBound"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireChannelBound(Channel channel, SocketAddress localAddress)
Sends a"channelBound"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelClosed(Channel channel)
Sends a"channelClosed"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelClosed(ChannelHandlerContext ctx)
Sends a"channelClosed"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
fireChannelClosedLater(Channel channel)
Sends a"channelClosed"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.static void
fireChannelConnected(ChannelHandlerContext ctx, SocketAddress remoteAddress)
Sends a"channelConnected"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireChannelConnected(Channel channel, SocketAddress remoteAddress)
Sends a"channelConnected"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelDisconnected(Channel channel)
Sends a"channelDisconnected"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelDisconnected(ChannelHandlerContext ctx)
Sends a"channelDisconnected"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
fireChannelDisconnectedLater(Channel channel)
Sends a"channelDisconnected"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.static void
fireChannelInterestChanged(Channel channel)
Sends a"channelInterestChanged"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelInterestChanged(ChannelHandlerContext ctx)
Sends a"channelInterestChanged"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
fireChannelInterestChangedLater(Channel channel)
Sends a"channelInterestChanged"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.static void
fireChannelOpen(Channel channel)
Sends a"channelOpen"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelOpen(ChannelHandlerContext ctx)
Sends a"channelOpen"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireChannelUnbound(Channel channel)
Sends a"channelUnbound"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireChannelUnbound(ChannelHandlerContext ctx)
Sends a"channelUnbound"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
fireChannelUnboundLater(Channel channel)
Sends a"channelUnbound"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.static void
fireExceptionCaught(ChannelHandlerContext ctx, Throwable cause)
Sends a"exceptionCaught"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireExceptionCaught(Channel channel, Throwable cause)
Sends a"exceptionCaught"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
fireExceptionCaughtLater(ChannelHandlerContext ctx, Throwable cause)
Sends a"exceptionCaught"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
once the io-thread runs again.static ChannelFuture
fireExceptionCaughtLater(Channel channel, Throwable cause)
Sends a"exceptionCaught"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.static void
fireMessageReceived(ChannelHandlerContext ctx, Object message)
Sends a"messageReceived"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireMessageReceived(ChannelHandlerContext ctx, Object message, SocketAddress remoteAddress)
Sends a"messageReceived"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireMessageReceived(Channel channel, Object message)
Sends a"messageReceived"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
fireMessageReceived(Channel channel, Object message, SocketAddress remoteAddress)
Sends a"messageReceived"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
belongs.static void
fireWriteComplete(ChannelHandlerContext ctx, long amount)
Sends a"writeComplete"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.static void
fireWriteComplete(Channel channel, long amount)
Sends a"writeComplete"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
fireWriteCompleteLater(Channel channel, long amount)
Sends a"writeComplete"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
in the next io-thread.static ChannelFuture
future(Channel channel)
Creates a new non-cancellableChannelFuture
for the specifiedChannel
.static ChannelFuture
future(Channel channel, boolean cancellable)
Creates a newChannelFuture
for the specifiedChannel
.static ChannelPipeline
pipeline()
Creates a newChannelPipeline
.static ChannelPipeline
pipeline(ChannelHandler... handlers)
Creates a newChannelPipeline
which contains the specifiedChannelHandler
s.static ChannelPipeline
pipeline(ChannelPipeline pipeline)
Creates a newChannelPipeline
which contains the same entries with the specifiedpipeline
.static ChannelPipelineFactory
pipelineFactory(ChannelPipeline pipeline)
Creates a newChannelPipelineFactory
which creates a newChannelPipeline
which contains the same entries with the specifiedpipeline
.static void
setInterestOps(ChannelHandlerContext ctx, ChannelFuture future, int interestOps)
Sends a"setInterestOps"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
setInterestOps(Channel channel, int interestOps)
Sends a"setInterestOps"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
succeededFuture(Channel channel)
Creates a newChannelFuture
which is already succeeded for the specifiedChannel
.static ChannelFuture
unbind(Channel channel)
Sends a"unbind"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static void
unbind(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"unbind"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static void
write(ChannelHandlerContext ctx, ChannelFuture future, Object message)
Sends a"write"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static void
write(ChannelHandlerContext ctx, ChannelFuture future, Object message, SocketAddress remoteAddress)
Sends a"write"
request to theChannelDownstreamHandler
which is placed in the closest downstream from the handler associated with the specifiedChannelHandlerContext
.static ChannelFuture
write(Channel channel, Object message)
Sends a"write"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.static ChannelFuture
write(Channel channel, Object message, SocketAddress remoteAddress)
Sends a"write"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
-
-
Method Detail
-
pipeline
public static ChannelPipeline pipeline()
Creates a newChannelPipeline
.
-
pipeline
public static ChannelPipeline pipeline(ChannelHandler... handlers)
Creates a newChannelPipeline
which contains the specifiedChannelHandler
s. 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 newChannelPipeline
which contains the same entries with the specifiedpipeline
. Please note that only the names and the references of theChannelHandler
s will be copied; a newChannelHandler
instance will never be created.
-
pipelineFactory
public static ChannelPipelineFactory pipelineFactory(ChannelPipeline pipeline)
Creates a newChannelPipelineFactory
which creates a newChannelPipeline
which contains the same entries with the specifiedpipeline
. Please note that only the names and the references of theChannelHandler
s will be copied; a newChannelHandler
instance will never be created.
-
future
public static ChannelFuture future(Channel channel)
Creates a new non-cancellableChannelFuture
for the specifiedChannel
.
-
future
public static ChannelFuture future(Channel channel, boolean cancellable)
Creates a newChannelFuture
for the specifiedChannel
.- Parameters:
cancellable
-true
if and only if the returned future can be canceled byChannelFuture.cancel()
-
succeededFuture
public static ChannelFuture succeededFuture(Channel channel)
Creates a newChannelFuture
which is already succeeded for the specifiedChannel
.
-
failedFuture
public static ChannelFuture failedFuture(Channel channel, Throwable cause)
Creates a newChannelFuture
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of 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 theChannelUpstreamHandler
which 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, SocketAddress localAddress)
Sends a"channelBound"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
localAddress
- the local address where the specified channel is bound
-
fireChannelBound
public static void fireChannelBound(ChannelHandlerContext ctx, SocketAddress localAddress)
Sends a"channelBound"
event to theChannelUpstreamHandler
which 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, SocketAddress remoteAddress)
Sends a"channelConnected"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
remoteAddress
- the remote address where the specified channel is connected
-
fireChannelConnected
public static void fireChannelConnected(ChannelHandlerContext ctx, SocketAddress remoteAddress)
Sends a"channelConnected"
event to theChannelUpstreamHandler
which 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, Object message)
Sends a"messageReceived"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
message
- the received message
-
fireMessageReceived
public static void fireMessageReceived(Channel channel, Object message, SocketAddress remoteAddress)
Sends a"messageReceived"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
belongs.- Parameters:
message
- the received messageremoteAddress
- the remote address where the received message came from
-
fireMessageReceived
public static void fireMessageReceived(ChannelHandlerContext ctx, Object message)
Sends a"messageReceived"
event to theChannelUpstreamHandler
which 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, Object message, SocketAddress remoteAddress)
Sends a"messageReceived"
event to theChannelUpstreamHandler
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
in the next io-thread.
-
fireWriteComplete
public static void fireWriteComplete(Channel channel, long amount)
Sends a"writeComplete"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireWriteComplete
public static void fireWriteComplete(ChannelHandlerContext ctx, long amount)
Sends a"writeComplete"
event to theChannelUpstreamHandler
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.
-
fireChannelInterestChanged
public static void fireChannelInterestChanged(Channel channel)
Sends a"channelInterestChanged"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireChannelInterestChanged
public static void fireChannelInterestChanged(ChannelHandlerContext ctx)
Sends a"channelInterestChanged"
event to theChannelUpstreamHandler
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.
-
fireChannelDisconnected
public static void fireChannelDisconnected(Channel channel)
Sends a"channelDisconnected"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireChannelDisconnected
public static void fireChannelDisconnected(ChannelHandlerContext ctx)
Sends a"channelDisconnected"
event to theChannelUpstreamHandler
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.
-
fireChannelUnbound
public static void fireChannelUnbound(Channel channel)
Sends a"channelUnbound"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireChannelUnbound
public static void fireChannelUnbound(ChannelHandlerContext ctx)
Sends a"channelUnbound"
event to theChannelUpstreamHandler
which 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 firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.
-
fireChannelClosed
public static void fireChannelClosed(Channel channel)
Sends a"channelClosed"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireChannelClosed
public static void fireChannelClosed(ChannelHandlerContext ctx)
Sends a"channelClosed"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.
-
fireExceptionCaughtLater
public static ChannelFuture fireExceptionCaughtLater(Channel channel, Throwable cause)
Sends a"exceptionCaught"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
once the io-thread runs again.
-
fireExceptionCaughtLater
public static ChannelFuture fireExceptionCaughtLater(ChannelHandlerContext ctx, Throwable cause)
Sends a"exceptionCaught"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
once the io-thread runs again.
-
fireExceptionCaught
public static void fireExceptionCaught(Channel channel, Throwable cause)
Sends a"exceptionCaught"
event to the firstChannelUpstreamHandler
in theChannelPipeline
of the specifiedChannel
.
-
fireExceptionCaught
public static void fireExceptionCaught(ChannelHandlerContext ctx, Throwable cause)
Sends a"exceptionCaught"
event to theChannelUpstreamHandler
which is placed in the closest upstream from the handler associated with the specifiedChannelHandlerContext
.
-
bind
public static ChannelFuture bind(Channel channel, SocketAddress localAddress)
Sends a"bind"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to bindlocalAddress
- the local address to bind to- Returns:
- the
ChannelFuture
which will be notified when the bind operation is done
-
bind
public static void bind(ChannelHandlerContext ctx, ChannelFuture future, SocketAddress localAddress)
Sends a"bind"
request to theChannelDownstreamHandler
which 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 theChannelDownstreamHandler
which 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 lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to unbind- Returns:
- the
ChannelFuture
which will be notified when the unbind operation is done
-
connect
public static ChannelFuture connect(Channel channel, SocketAddress remoteAddress)
Sends a"connect"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to attempt a connectionremoteAddress
- the remote address to connect to- Returns:
- the
ChannelFuture
which will be notified when the connection attempt is done
-
connect
public static void connect(ChannelHandlerContext ctx, ChannelFuture future, SocketAddress remoteAddress)
Sends a"connect"
request to theChannelDownstreamHandler
which 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, Object message)
Sends a"write"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to write a messagemessage
- the message to write to the channel- Returns:
- the
ChannelFuture
which will be notified when the write operation is done
-
write
public static void write(ChannelHandlerContext ctx, ChannelFuture future, Object message)
Sends a"write"
request to theChannelDownstreamHandler
which 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, Object message, SocketAddress remoteAddress)
Sends a"write"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to write a messagemessage
- the message to write to the channelremoteAddress
- the destination of the message.null
to use the default remote address- Returns:
- the
ChannelFuture
which will be notified when the write operation is done
-
write
public static void write(ChannelHandlerContext ctx, ChannelFuture future, Object message, SocketAddress remoteAddress)
Sends a"write"
request to theChannelDownstreamHandler
which 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.null
to use the default remote address.
-
setInterestOps
public static ChannelFuture setInterestOps(Channel channel, int interestOps)
Sends a"setInterestOps"
request to the lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to change its interestOpsinterestOps
- the new interestOps- Returns:
- the
ChannelFuture
which will be notified when the interestOps is changed
-
setInterestOps
public static void setInterestOps(ChannelHandlerContext ctx, ChannelFuture future, int interestOps)
Sends a"setInterestOps"
request to theChannelDownstreamHandler
which 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 lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to disconnect- Returns:
- the
ChannelFuture
which will be notified on disconnection
-
disconnect
public static void disconnect(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"disconnect"
request to theChannelDownstreamHandler
which 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 lastChannelDownstreamHandler
in theChannelPipeline
of the specifiedChannel
.- Parameters:
channel
- the channel to close- Returns:
- the
ChannelFuture
which will be notified on closure
-
close
public static void close(ChannelHandlerContext ctx, ChannelFuture future)
Sends a"close"
request to theChannelDownstreamHandler
which 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
-
-