The state value of channelInterestChanged event is useless - added the event triggering method which doesn't require a state value and deprecated the old ones
This commit is contained in:
parent
bd403bdb98
commit
7a9c72fd76
@ -329,32 +329,58 @@ public class Channels {
|
||||
* Sends a {@code "channelInterestChanged"} event to the first
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
||||
* the specified {@link Channel}.
|
||||
*
|
||||
* @param interestOps the new interestOps
|
||||
*/
|
||||
public static void fireChannelInterestChanged(Channel channel, int interestOps) {
|
||||
validateInterestOps(interestOps);
|
||||
public static void fireChannelInterestChanged(Channel channel) {
|
||||
channel.getPipeline().sendUpstream(
|
||||
new DefaultChannelStateEvent(
|
||||
channel, succeededFuture(channel),
|
||||
ChannelState.INTEREST_OPS, Integer.valueOf(interestOps)));
|
||||
ChannelState.INTEREST_OPS, Channel.OP_READ));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelInterestChanged(Channel)} instead.
|
||||
*
|
||||
* Sends a {@code "channelInterestChanged"} event to the first
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} of
|
||||
* the specified {@link Channel}.
|
||||
*
|
||||
* @param interestOps the new interestOps
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelInterestChanged(
|
||||
Channel channel, @SuppressWarnings("unused") int interestOps) {
|
||||
fireChannelInterestChanged(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a {@code "channelInterestChanged"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
*
|
||||
* @param interestOps the new interestOps
|
||||
*/
|
||||
public static void fireChannelInterestChanged(
|
||||
ChannelHandlerContext ctx, Channel channel, int interestOps) {
|
||||
ChannelHandlerContext ctx, Channel channel) {
|
||||
|
||||
validateInterestOps(interestOps);
|
||||
ctx.sendUpstream(
|
||||
new DefaultChannelStateEvent(
|
||||
channel, succeededFuture(channel),
|
||||
ChannelState.INTEREST_OPS, Integer.valueOf(interestOps)));
|
||||
ChannelState.INTEREST_OPS, Channel.OP_READ));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #fireChannelInterestChanged(ChannelHandlerContext, Channel)} instead.
|
||||
*
|
||||
* Sends a {@code "channelInterestChanged"} event to the next
|
||||
* {@link ChannelUpstreamHandler} in the {@link ChannelPipeline} where
|
||||
* the specified {@link ChannelHandlerContext} belongs.
|
||||
*
|
||||
* @param interestOps the new interestOps
|
||||
*/
|
||||
@Deprecated
|
||||
public static void fireChannelInterestChanged(
|
||||
ChannelHandlerContext ctx, Channel channel,
|
||||
@SuppressWarnings("unused") int interestOps) {
|
||||
|
||||
fireChannelInterestChanged(ctx, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,24 +89,12 @@ public class DefaultChannelStateEvent extends DefaultChannelEvent implements
|
||||
}
|
||||
break;
|
||||
case INTEREST_OPS:
|
||||
switch (((Integer) getValue()).intValue()) {
|
||||
case Channel.OP_NONE:
|
||||
buf.append("OP_NONE");
|
||||
break;
|
||||
case Channel.OP_READ:
|
||||
buf.append("OP_READ");
|
||||
break;
|
||||
case Channel.OP_WRITE:
|
||||
buf.append("OP_WRITE");
|
||||
break;
|
||||
case Channel.OP_READ_WRITE:
|
||||
buf.append("OP_READ_WRITE");
|
||||
buf.append("INTEREST_CHANGED");
|
||||
break;
|
||||
default:
|
||||
buf.append("UNKNOWN(");
|
||||
buf.append(getState().name());
|
||||
buf.append(": ");
|
||||
buf.append(getValue());
|
||||
buf.append(')');
|
||||
}
|
||||
}
|
||||
buf.append(')');
|
||||
return buf.toString();
|
||||
|
@ -185,8 +185,7 @@ abstract class NioSocketChannel extends AbstractChannel
|
||||
highWaterMarkCounter.incrementAndGet();
|
||||
if (!notifying.get()) {
|
||||
notifying.set(Boolean.TRUE);
|
||||
fireChannelInterestChanged(
|
||||
NioSocketChannel.this, getRawInterestOps() | OP_WRITE);
|
||||
fireChannelInterestChanged(NioSocketChannel.this);
|
||||
notifying.set(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
@ -207,8 +206,7 @@ abstract class NioSocketChannel extends AbstractChannel
|
||||
highWaterMarkCounter.decrementAndGet();
|
||||
if (!notifying.get()) {
|
||||
notifying.set(Boolean.TRUE);
|
||||
fireChannelInterestChanged(
|
||||
NioSocketChannel.this, getRawInterestOps() & ~OP_WRITE);
|
||||
fireChannelInterestChanged(NioSocketChannel.this);
|
||||
notifying.set(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ class NioWorker implements Runnable {
|
||||
future.setSuccess();
|
||||
if (changed) {
|
||||
channel.setRawInterestOpsNow(interestOps);
|
||||
fireChannelInterestChanged(channel, interestOps);
|
||||
fireChannelInterestChanged(channel);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
future.setFailure(t);
|
||||
|
@ -151,7 +151,7 @@ class OioWorker implements Runnable {
|
||||
}
|
||||
|
||||
channel.setInterestOpsNow(interestOps);
|
||||
fireChannelInterestChanged(channel, interestOps);
|
||||
fireChannelInterestChanged(channel);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
future.setFailure(t);
|
||||
|
Loading…
Reference in New Issue
Block a user