This is an automated email from the ASF dual-hosted git repository.

lollipop pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new e3b5f07ae [ISSUE #6438] Optimizing the memory usage of 
MultiProtocolRemotingServer (#6439)
e3b5f07ae is described below

commit e3b5f07ae882bd7f3857de1c8114b88c38ef0ddd
Author: lk <[email protected]>
AuthorDate: Wed Mar 22 19:09:49 2023 +0800

    [ISSUE #6438] Optimizing the memory usage of MultiProtocolRemotingServer 
(#6439)
---
 .../proxy/remoting/MultiProtocolRemotingServer.java   | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git 
a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolRemotingServer.java
 
b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolRemotingServer.java
index 74fb3616c..9f94c248f 100644
--- 
a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolRemotingServer.java
+++ 
b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/MultiProtocolRemotingServer.java
@@ -44,9 +44,19 @@ public class MultiProtocolRemotingServer extends 
NettyRemotingServer {
     private final static Logger log = 
LoggerFactory.getLogger(LoggerName.PROXY_LOGGER_NAME);
     private final NettyServerConfig nettyServerConfig;
 
+    private final RemotingProtocolHandler remotingProtocolHandler;
+    private final Http2ProtocolProxyHandler http2ProtocolProxyHandler;
+
     public MultiProtocolRemotingServer(NettyServerConfig nettyServerConfig, 
ChannelEventListener channelEventListener) {
         super(nettyServerConfig, channelEventListener);
         this.nettyServerConfig = nettyServerConfig;
+
+        this.remotingProtocolHandler = new RemotingProtocolHandler(
+            this.getEncoder(),
+            this.getDistributionHandler(),
+            this.getConnectionManageHandler(),
+            this.getServerHandler());
+        this.http2ProtocolProxyHandler = new Http2ProtocolProxyHandler();
     }
 
     @Override
@@ -70,13 +80,8 @@ public class MultiProtocolRemotingServer extends 
NettyRemotingServer {
             .addLast(this.getDefaultEventExecutorGroup(), 
HANDSHAKE_HANDLER_NAME, this.getHandshakeHandler())
             .addLast(this.getDefaultEventExecutorGroup(),
                 new IdleStateHandler(0, 0, 
nettyServerConfig.getServerChannelMaxIdleTimeSeconds()),
-                new ProtocolNegotiationHandler(
-                    new RemotingProtocolHandler(
-                        this.getEncoder(),
-                        this.getDistributionHandler(),
-                        this.getConnectionManageHandler(),
-                        this.getServerHandler()))
-                    .addProtocolHandler(new Http2ProtocolProxyHandler())
+                new ProtocolNegotiationHandler(this.remotingProtocolHandler)
+                    .addProtocolHandler(this.http2ProtocolProxyHandler)
             );
     }
 }

Reply via email to