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

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 5f35f0dd18 refactor: inspect code of netty4 classes. (#10295)
5f35f0dd18 is described below

commit 5f35f0dd183e09cc4f4b7456a651bcdc093247cf
Author: stone_lion <[email protected]>
AuthorDate: Mon Jul 11 09:48:50 2022 +0800

    refactor: inspect code of netty4 classes. (#10295)
---
 .../org/apache/dubbo/remoting/transport/netty4/NettyClient.java   | 8 +++-----
 .../org/apache/dubbo/remoting/transport/netty4/NettyServer.java   | 2 +-
 .../dubbo/remoting/transport/netty4/NettyServerHandler.java       | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
index 9c79404743..7298c480d0 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyClient.java
@@ -16,6 +16,7 @@
  */
 package org.apache.dubbo.remoting.transport.netty4;
 
+import io.netty.util.concurrent.EventExecutorGroup;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.Version;
 import org.apache.dubbo.common.config.ConfigurationUtils;
@@ -68,7 +69,7 @@ public class NettyClient extends AbstractClient {
      */
     private static final GlobalResourceInitializer<EventLoopGroup> 
EVENT_LOOP_GROUP = new GlobalResourceInitializer<>(() ->
         eventLoopGroup(Constants.DEFAULT_IO_THREADS, "NettyClientWorker"),
-        eventLoopGroup -> eventLoopGroup.shutdownGracefully());
+        EventExecutorGroup::shutdownGracefully);
 
     private Bootstrap bootstrap;
 
@@ -143,10 +144,7 @@ public class NettyClient extends AbstractClient {
 
     private boolean isFilteredAddress(String host) {
         // filter local address
-        if (StringUtils.isEquals(NetUtils.getLocalHost(), host) || 
NetUtils.isLocalHost(host)) {
-            return true;
-        }
-        return false;
+        return StringUtils.isEquals(NetUtils.getLocalHost(), host) || 
NetUtils.isLocalHost(host);
     }
 
     @Override
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java
index 4be34e1039..5c4ce032cc 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java
@@ -81,7 +81,7 @@ public class NettyServer extends AbstractServer {
     private final int serverShutdownTimeoutMills;
 
     public NettyServer(URL url, ChannelHandler handler) throws 
RemotingException {
-        // you can customize name and type of client thread pool by 
THREAD_NAME_KEY and THREADPOOL_KEY in CommonConstants.
+        // you can customize name and type of client thread pool by 
THREAD_NAME_KEY and THREAD_POOL_KEY in CommonConstants.
         // the handler will be wrapped: 
MultiMessageHandler->HeartbeatHandler->handler
         super(ExecutorUtil.setThreadName(url, SERVER_THREAD_POOL_NAME), 
ChannelHandlers.wrap(handler, url));
 
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
index b26b9f14c9..8eaeb9457c 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServerHandler.java
@@ -42,7 +42,7 @@ public class NettyServerHandler extends ChannelDuplexHandler {
      * the cache for alive worker channel.
      * <ip:port, dubbo channel>
      */
-    private final Map<String, Channel> channels = new 
ConcurrentHashMap<String, Channel>();
+    private final Map<String, Channel> channels = new ConcurrentHashMap<>();
 
     private final URL url;
 

Reply via email to