@Target(value=METHOD) @Retention(value=RUNTIME) public static @interface ChannelHandler.Skip
ChannelHandler
will not be invoked by
ChannelPipeline
. This annotation is only useful when your handler method implementation
only passes the event through to the next handler, like the following:
@Skip
@Override
public void channelActive(ChannelHandlerContext
ctx) { ctx.fireChannelActive(); // do nothing but passing through to the next handler }
ChannelHandler.handlerAdded(ChannelHandlerContext)
and ChannelHandler.handlerRemoved(ChannelHandlerContext)
are not able to
pass the event through to the next handler, so they must do nothing when annotated.
@Skip
@Override
public void handlerAdded(ChannelHandlerContext
ctx) { // do nothing }
Note that this annotation is not inherited. If you override a method annotated with
ChannelHandler.Skip
, it will not be skipped anymore. Similarly, you can override a method not annotated with
ChannelHandler.Skip
and simply pass the event through to the next handler, which reverses the behavior of the
supertype.
Copyright © 2008–2015 The Netty Project. All rights reserved.