You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that in the no-argument constructor of the NettyRpcClient class, the bootstrap.handler() method is called twice. Will the ChannelInitializer added by the second call overwrite the LoggingHandler added by the first call?
public NettyRpcClient() {
//....
Bootstrap bootstrap = = new Bootstrap();
bootstrap
.handler(new LoggingHandler(LogLevel.INFO))
//...
.handler(new ChannelInitializer() { @OverRide
protected void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
// If no data is sent to the server within 15 seconds, a heartbeat request is sent
p.addLast(new IdleStateHandler(0, 5, 0, TimeUnit.SECONDS));
p.addLast(new RpcMessageEncoder());
p.addLast(new RpcMessageDecoder());
p.addLast(new NettyRpcClientHandler());
}
});
}
The handler() method of the Bootstrap class is as follows:
public B handler(ChannelHandler handler) {
this.handler = ObjectUtil.checkNotNull(handler, "handler");
return self();
}
Will the second handler overwrite the first handler?
The text was updated successfully, but these errors were encountered:
I noticed that in the no-argument constructor of the NettyRpcClient class, the bootstrap.handler() method is called twice. Will the ChannelInitializer added by the second call overwrite the LoggingHandler added by the first call?
public NettyRpcClient() {
//....
Bootstrap bootstrap = = new Bootstrap();
bootstrap
.handler(new LoggingHandler(LogLevel.INFO))
//...
.handler(new ChannelInitializer() {
@OverRide
protected void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
// If no data is sent to the server within 15 seconds, a heartbeat request is sent
p.addLast(new IdleStateHandler(0, 5, 0, TimeUnit.SECONDS));
p.addLast(new RpcMessageEncoder());
p.addLast(new RpcMessageDecoder());
p.addLast(new NettyRpcClientHandler());
}
});
}
The handler() method of the Bootstrap class is as follows:
public B handler(ChannelHandler handler) {
this.handler = ObjectUtil.checkNotNull(handler, "handler");
return self();
}
Will the second handler overwrite the first handler?
The text was updated successfully, but these errors were encountered: