Category : netty

Order When using netty to develop rpc, one of the problems facing the client side is how the client can easily call remote services. Rmi in java gives a good example through proxy mode. Through proxy, calling remote service is as simple as calling local service for users. For published services, interfaces using java are ..

Read more

Order Here is a summary of netty’s knowledge. SimpleChannelInboundHandler When an implementation of a ChannelInboundHandler overwrites the channelRead () method, it will be responsible for explicitly freeing the memory associated with the pooled ByteBuf instance. Netty provides a practical method for this, ReferenceCountUtil.release (), but managing resources in this way can be tedious. A simpler ..

Read more

Order This article mainly studies netty’s maxDirectMemory (io.netty.maxDirectMemory) PlatformDependent netty-common-4.1.33.Final-sources.jar! /io/netty/util/internal/PlatformDependent.java public final class PlatformDependent { private static final InternalLogger logger = InternalLoggerFactory.getInstance(PlatformDependent.class); private static final Pattern MAX_DIRECT_MEMORY_SIZE_ARG_PATTERN = Pattern.compile( “\\s*-XX:MaxDirectMemorySize\\s*=\\s*([0-9]+)\\s*([kKmMgG]?)\\s*$”); private static final boolean IS_WINDOWS = isWindows0(); private static final boolean IS_OSX = isOsx0(); private static final boolean MAYBE_SUPER_USER; private static final boolean CAN_ENABLE_TCP_NODELAY_BY_DEFAULT ..

Read more

Order This article mainly studies netty’s ResourceLeakDetector LEAK anomaly 2019-04-02 15:23:17.026 ERROR 1 — [reactor-http-epoll-2] io.netty.util.ResourceLeakDetector : LEAK: ByteBuf.release() was not called before it’s garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information. Recent access records: #1: io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286) io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930) io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799) io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:427) io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:328) io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) java.base/java.lang.Thread.run(Thread.java:835) #2: io.netty.buffer.AdvancedLeakAwareByteBuf.forEachByte(AdvancedLeakAwareByteBuf.java:670) io.netty.handler.codec.http.HttpObjectDecoder$HeaderParser.parse(HttpObjectDecoder.java:801) io.netty.handler.codec.http.HttpObjectDecoder.readHeaders(HttpObjectDecoder.java:601) io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:227) io.netty.handler.codec.http.HttpClientCodec$Decoder.decode(HttpClientCodec.java:202) io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502) ..

Read more

Order This article mainly studies reactor-netty AccessLog. Open access log For spring boot applications using tomcat, it can be opened by server.tomcat.accesslog.enabled = true For a spring boot application that uses jetty, it can be opened by server.Jetty.accesslog.enabled = true. For spring boot applications that use undertow, it can be opened by Server.Undertow.AccessLog.Enabled = True ..

Read more

Order This article mainly studies AccessLogHandlerH2 of reactor-netty. AccessLogHandlerH2 reactor-netty-0.8.5.RELEASE-sources.jar! /reactor/netty/http/server/AccessLogHandlerH2.java final class AccessLogHandlerH2 extends ChannelDuplexHandler { static final String H2_PROTOCOL_NAME = “HTTP/2.0”; AccessLog accessLog = new AccessLog(); @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Http2HeadersFrame){ final Http2HeadersFrame requestHeaders = (Http2HeadersFrame) msg; final SocketChannel channel = (SocketChannel) ctx.channel() .parent(); ..

Read more