Add FlushConsolidationHandler
This commit is contained in:
+2
@@ -27,6 +27,7 @@ import io.netty.channel.*;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
|
||||
import io.netty.handler.codec.LengthFieldPrepender;
|
||||
import io.netty.handler.flush.FlushConsolidationHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/** Used when creating a network channel */
|
||||
@@ -48,6 +49,7 @@ public class NettyChannelInitializer extends ChannelInitializer<SocketChannel>
|
||||
ChannelPipeline pipeline = socketChannel.pipeline();
|
||||
|
||||
// Encoder
|
||||
pipeline.addLast(new FlushConsolidationHandler(FlushConsolidationHandler.DEFAULT_EXPLICIT_FLUSH_AFTER_FLUSHES, true));
|
||||
pipeline.addLast(new LengthFieldPrepender(Integer.BYTES));
|
||||
pipeline.addLast(new MessageEncoder<>(NettyMessageRegistry.INSTANCE, NettyMessage.class));
|
||||
pipeline.addLast(new NettyOutboundExceptionRouter());
|
||||
|
||||
Reference in New Issue
Block a user