|
|
|
@ -199,14 +199,28 @@ public class Channels {
|
|
|
|
|
* this method does not send a {@code "childChannelOpen"} event unlike
|
|
|
|
|
* {@link #fireChannelOpen(Channel)} method.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelOpen(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel) {
|
|
|
|
|
|
|
|
|
|
public static void fireChannelOpen(ChannelHandlerContext ctx) {
|
|
|
|
|
ctx.sendUpstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.OPEN, Boolean.TRUE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelOpen(ChannelHandlerContext)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelOpen"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs. Please note that
|
|
|
|
|
* this method does not send a {@code "childChannelOpen"} event unlike
|
|
|
|
|
* {@link #fireChannelOpen(Channel)} method.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelOpen(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel) {
|
|
|
|
|
fireChannelOpen(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "channelBound"} event to the first
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -230,14 +244,30 @@ public class Channels {
|
|
|
|
|
* @param localAddress
|
|
|
|
|
* the local address where the specified channel is bound
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelBound(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, SocketAddress localAddress) {
|
|
|
|
|
|
|
|
|
|
public static void fireChannelBound(ChannelHandlerContext ctx, SocketAddress localAddress) {
|
|
|
|
|
ctx.sendUpstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.BOUND, localAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelBound(ChannelHandlerContext, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelBound"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param localAddress
|
|
|
|
|
* the local address where the specified channel is bound
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelBound(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
SocketAddress localAddress) {
|
|
|
|
|
fireChannelBound(ctx, localAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "channelConnected"} event to the first
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -261,14 +291,31 @@ public class Channels {
|
|
|
|
|
* @param remoteAddress
|
|
|
|
|
* the remote address where the specified channel is connected
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelConnected(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress) {
|
|
|
|
|
public static void fireChannelConnected(ChannelHandlerContext ctx, SocketAddress remoteAddress) {
|
|
|
|
|
|
|
|
|
|
ctx.sendUpstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.CONNECTED, remoteAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelConnected(ChannelHandlerContext, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelConnected"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param remoteAddress
|
|
|
|
|
* the remote address where the specified channel is connected
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelConnected(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
SocketAddress remoteAddress) {
|
|
|
|
|
fireChannelConnected(ctx, remoteAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "messageReceived"} event to the first
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -303,10 +350,26 @@ public class Channels {
|
|
|
|
|
*
|
|
|
|
|
* @param message the received message
|
|
|
|
|
*/
|
|
|
|
|
public static void fireMessageReceived(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, Object message) {
|
|
|
|
|
public static void fireMessageReceived(ChannelHandlerContext ctx, Object message) {
|
|
|
|
|
ctx.sendUpstream(new DefaultMessageEvent(
|
|
|
|
|
channel, succeededFuture(channel), message, null));
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()), message, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireMessageReceived(ChannelHandlerContext, Object)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "messageReceived"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param message the received message
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireMessageReceived(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
Object message) {
|
|
|
|
|
fireMessageReceived(ctx, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -319,10 +382,28 @@ public class Channels {
|
|
|
|
|
* came from
|
|
|
|
|
*/
|
|
|
|
|
public static void fireMessageReceived(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
Object message, SocketAddress remoteAddress) {
|
|
|
|
|
ChannelHandlerContext ctx, Object message, SocketAddress remoteAddress) {
|
|
|
|
|
ctx.sendUpstream(new DefaultMessageEvent(
|
|
|
|
|
channel, succeededFuture(channel), message, remoteAddress));
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()), message, remoteAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireMessageReceived(ChannelHandlerContext, Object, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "messageReceived"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param message the received message
|
|
|
|
|
* @param remoteAddress the remote address where the received message
|
|
|
|
|
* came from
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireMessageReceived(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
Object message, SocketAddress remoteAddress) {
|
|
|
|
|
fireMessageReceived(ctx, message, remoteAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -358,16 +439,16 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelInterestChanged(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel) {
|
|
|
|
|
ChannelHandlerContext ctx) {
|
|
|
|
|
|
|
|
|
|
ctx.sendUpstream(
|
|
|
|
|
new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.INTEREST_OPS, Channel.OP_READ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelInterestChanged(ChannelHandlerContext, Channel)} instead.
|
|
|
|
|
* @deprecated Use {@link #fireChannelInterestChanged(ChannelHandlerContext)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelInterestChanged"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
@ -377,10 +458,11 @@ public class Channels {
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelInterestChanged(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
@SuppressWarnings("unused") int interestOps) {
|
|
|
|
|
|
|
|
|
|
fireChannelInterestChanged(ctx, channel);
|
|
|
|
|
fireChannelInterestChanged(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -400,13 +482,26 @@ public class Channels {
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelDisconnected(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel) {
|
|
|
|
|
public static void fireChannelDisconnected(ChannelHandlerContext ctx) {
|
|
|
|
|
ctx.sendUpstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.CONNECTED, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelDisconnected(ChannelHandlerContext)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelDisconnected"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelDisconnected(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel) {
|
|
|
|
|
fireChannelDisconnected(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "channelUnbound"} event to the first
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -422,11 +517,24 @@ public class Channels {
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelUnbound(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel) {
|
|
|
|
|
public static void fireChannelUnbound(ChannelHandlerContext ctx) {
|
|
|
|
|
|
|
|
|
|
ctx.sendUpstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel), ChannelState.BOUND, null));
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()), ChannelState.BOUND, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelUnbound(ChannelHandlerContext)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelUnbound"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelUnbound(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel) {
|
|
|
|
|
fireChannelUnbound(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -449,14 +557,27 @@ public class Channels {
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireChannelClosed(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel) {
|
|
|
|
|
public static void fireChannelClosed(ChannelHandlerContext ctx) {
|
|
|
|
|
ctx.sendUpstream(
|
|
|
|
|
new DefaultChannelStateEvent(
|
|
|
|
|
channel, succeededFuture(channel),
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()),
|
|
|
|
|
ChannelState.OPEN, Boolean.FALSE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireChannelClosed(ChannelHandlerContext)}.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "channelClosed"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireChannelClosed(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel) {
|
|
|
|
|
fireChannelClosed(ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "exceptionCaught"} event to the first
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -473,10 +594,24 @@ public class Channels {
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
public static void fireExceptionCaught(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, Throwable cause) {
|
|
|
|
|
public static void fireExceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
|
|
|
|
ctx.sendUpstream(new DefaultExceptionEvent(
|
|
|
|
|
channel, succeededFuture(channel), cause));
|
|
|
|
|
ctx.getChannel(), succeededFuture(ctx.getChannel()), cause));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #fireExceptionCaught(ChannelHandlerContext, Throwable)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "exceptionCaught"} event to the next
|
|
|
|
|
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void fireExceptionCaught(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
Throwable cause) {
|
|
|
|
|
fireExceptionCaught(ctx, cause);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void fireChildChannelStateChanged(
|
|
|
|
@ -513,22 +648,57 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to bind
|
|
|
|
|
* @param future the future which will be notified when the bind
|
|
|
|
|
* operation is done
|
|
|
|
|
* @param localAddress the local address to bind to
|
|
|
|
|
*/
|
|
|
|
|
public static void bind(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelFuture future, SocketAddress localAddress) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future, SocketAddress localAddress) {
|
|
|
|
|
if (localAddress == null) {
|
|
|
|
|
throw new NullPointerException("localAddress");
|
|
|
|
|
}
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.BOUND, localAddress));
|
|
|
|
|
ctx.getChannel(), future, ChannelState.BOUND, localAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #bind(ChannelHandlerContext, ChannelFuture, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "bind"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to bind
|
|
|
|
|
* @param future the future which will be notified when the bind
|
|
|
|
|
* operation is done
|
|
|
|
|
* @param localAddress the local address to bind to
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void bind(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future, SocketAddress localAddress) {
|
|
|
|
|
bind(ctx, future, localAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "unbind"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param future the future which will be notified when the unbind
|
|
|
|
|
* operation is done
|
|
|
|
|
*/
|
|
|
|
|
public static void unbind(ChannelHandlerContext ctx, ChannelFuture future) {
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
ctx.getChannel(), future, ChannelState.BOUND, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #unbind(ChannelHandlerContext, ChannelFuture)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "unbind"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
@ -538,10 +708,12 @@ public class Channels {
|
|
|
|
|
* @param future the future which will be notified when the unbind
|
|
|
|
|
* operation is done
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void unbind(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, ChannelFuture future) {
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.BOUND, null));
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future) {
|
|
|
|
|
unbind(ctx, future);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -588,19 +760,38 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to attempt a connection
|
|
|
|
|
* @param future the future which will be notified when the connection
|
|
|
|
|
* attempt is done
|
|
|
|
|
* @param remoteAddress the remote address to connect to
|
|
|
|
|
*/
|
|
|
|
|
public static void connect(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelFuture future, SocketAddress remoteAddress) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future, SocketAddress remoteAddress) {
|
|
|
|
|
if (remoteAddress == null) {
|
|
|
|
|
throw new NullPointerException("remoteAddress");
|
|
|
|
|
}
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.CONNECTED, remoteAddress));
|
|
|
|
|
ctx.getChannel(), future, ChannelState.CONNECTED, remoteAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #connect(ChannelHandlerContext, ChannelFuture, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "connect"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to attempt a connection
|
|
|
|
|
* @param future the future which will be notified when the connection
|
|
|
|
|
* attempt is done
|
|
|
|
|
* @param remoteAddress the remote address to connect to
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void connect(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future, SocketAddress remoteAddress) {
|
|
|
|
|
connect(ctx, future, remoteAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -624,14 +815,32 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to write a message
|
|
|
|
|
* @param future the future which will be notified when the write
|
|
|
|
|
* operation is done
|
|
|
|
|
*/
|
|
|
|
|
public static void write(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future, Object message) {
|
|
|
|
|
write(ctx, future, message, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #write(ChannelHandlerContext, ChannelFuture, Object)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "write"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to write a message
|
|
|
|
|
* @param future the future which will be notified when the write
|
|
|
|
|
* operation is done
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void write(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future, Object message) {
|
|
|
|
|
write(ctx, channel, future, message, null);
|
|
|
|
|
write(ctx, future, message, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -660,7 +869,6 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to write a message
|
|
|
|
|
* @param future the future which will be notified when the write
|
|
|
|
|
* operation is done
|
|
|
|
|
* @param message the message to write to the channel
|
|
|
|
@ -668,10 +876,33 @@ public class Channels {
|
|
|
|
|
* {@code null} to use the default remote address.
|
|
|
|
|
*/
|
|
|
|
|
public static void write(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelFuture future, Object message, SocketAddress remoteAddress) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future,
|
|
|
|
|
Object message, SocketAddress remoteAddress) {
|
|
|
|
|
ctx.sendDownstream(
|
|
|
|
|
new DefaultMessageEvent(channel, future, message, remoteAddress));
|
|
|
|
|
new DefaultMessageEvent(ctx.getChannel(), future, message, remoteAddress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #write(ChannelHandlerContext, ChannelFuture, Object, SocketAddress)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "write"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to write a message
|
|
|
|
|
* @param future the future which will be notified when the write
|
|
|
|
|
* operation is done
|
|
|
|
|
* @param message the message to write to the channel
|
|
|
|
|
* @param remoteAddress the destination of the message.
|
|
|
|
|
* {@code null} to use the default remote address.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void write(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future, Object message, SocketAddress remoteAddress) {
|
|
|
|
|
write(ctx, future, message, remoteAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -701,22 +932,40 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to change the interestOps
|
|
|
|
|
* @param future the future which will be notified when the interestOps is
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
public static void setInterestOps(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel,
|
|
|
|
|
ChannelFuture future, int interestOps) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future, int interestOps) {
|
|
|
|
|
validateInterestOps(interestOps);
|
|
|
|
|
interestOps = filterDownstreamInterestOps(interestOps);
|
|
|
|
|
|
|
|
|
|
ctx.sendDownstream(
|
|
|
|
|
new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.INTEREST_OPS,
|
|
|
|
|
ctx.getChannel(), future, ChannelState.INTEREST_OPS,
|
|
|
|
|
Integer.valueOf(interestOps)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #setInterestOps(ChannelHandlerContext, ChannelFuture, int)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "setInterestOps"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to change the interestOps
|
|
|
|
|
* @param future the future which will be notified when the interestOps is
|
|
|
|
|
* changed.
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void setInterestOps(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel,
|
|
|
|
|
ChannelFuture future, int interestOps) {
|
|
|
|
|
setInterestOps(ctx, future, interestOps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sends a {@code "disconnect"} request to the last
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} of
|
|
|
|
@ -739,13 +988,30 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to disconnect
|
|
|
|
|
* @param future the future which will be notified on disconnection
|
|
|
|
|
*/
|
|
|
|
|
public static void disconnect(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, ChannelFuture future) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future) {
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.CONNECTED, null));
|
|
|
|
|
ctx.getChannel(), future, ChannelState.CONNECTED, null));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #disconnect(ChannelHandlerContext, ChannelFuture)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "disconnect"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to disconnect
|
|
|
|
|
* @param future the future which will be notified on disconnection
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void disconnect(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel, ChannelFuture future) {
|
|
|
|
|
disconnect(ctx, future);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -770,13 +1036,30 @@ public class Channels {
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to close
|
|
|
|
|
* @param future the future which will be notified on closure
|
|
|
|
|
*/
|
|
|
|
|
public static void close(
|
|
|
|
|
ChannelHandlerContext ctx, Channel channel, ChannelFuture future) {
|
|
|
|
|
ChannelHandlerContext ctx, ChannelFuture future) {
|
|
|
|
|
ctx.sendDownstream(new DefaultChannelStateEvent(
|
|
|
|
|
channel, future, ChannelState.OPEN, Boolean.FALSE));
|
|
|
|
|
ctx.getChannel(), future, ChannelState.OPEN, Boolean.FALSE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link #close(ChannelHandlerContext, ChannelFuture)} instead.
|
|
|
|
|
*
|
|
|
|
|
* Sends a {@code "close"} request to the previous
|
|
|
|
|
* {@link ChannelDownstreamHandler} in the {@link ChannelPipeline} where
|
|
|
|
|
* the specified {@link ChannelHandlerContext} belongs.
|
|
|
|
|
*
|
|
|
|
|
* @param ctx the context
|
|
|
|
|
* @param channel the channel to close
|
|
|
|
|
* @param future the future which will be notified on closure
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public static void close(
|
|
|
|
|
ChannelHandlerContext ctx,
|
|
|
|
|
@SuppressWarnings("unused") Channel channel, ChannelFuture future) {
|
|
|
|
|
close(ctx, future);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void validateInterestOps(int interestOps) {
|
|
|
|
|