0
我有一個ChannelOutboundHandlerAdapter
,它覆蓋了方法write
。什麼是調用父類的方法write
之間的差異:Netty ChannelOutboundHandlerAdapter寫入
public class MyChannelOutboundHandler extends ChannelOutboundHandlerAdapter {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
//some code
super.write(ctx, anotherMessage, promise);
}
}
和調用上下文write
:
public class MyChannelOutboundHandler extends ChannelOutboundHandlerAdapter {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
//some code
ctx.write(anotherMessage);
}
}