You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2022/03/22 02:01:51 UTC

[james-project] 20/29: JAMES-3715 Name netty threads

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

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 5926ca203cb0bd5b6ccf3cfbce6a7e7a1f8bd243
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Mar 17 14:03:37 2022 +0700

    JAMES-3715 Name netty threads
    
    This helps reviewing thread usage when relying on jstack utility.
---
 .../java/org/apache/james/protocols/netty/AbstractAsyncServer.java  | 6 ++++--
 .../james/protocols/lib/netty/AbstractConfigurableAsyncServer.java  | 1 -
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
index e723546..a2f8e93 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.james.protocols.api.ProtocolServer;
+import org.apache.james.util.concurrent.NamedThreadFactory;
 
 import com.google.common.collect.ImmutableList;
 
@@ -60,6 +61,7 @@ public abstract class AbstractAsyncServer implements ProtocolServer {
     private volatile int ioWorker = DEFAULT_IO_WORKER_COUNT;
     
     private List<InetSocketAddress> addresses = new ArrayList<>();
+    protected String jmxName;
     
     public synchronized void setListenAddresses(InetSocketAddress... addresses) {
         if (started) {
@@ -91,8 +93,8 @@ public abstract class AbstractAsyncServer implements ProtocolServer {
         ServerBootstrap bootstrap = new ServerBootstrap();
         bootstrap.channel(NioServerSocketChannel.class);
 
-        bossGroup = new NioEventLoopGroup();
-        workerGroup = new NioEventLoopGroup(ioWorker);
+        bossGroup = new NioEventLoopGroup(NamedThreadFactory.withName(jmxName + "-boss"));
+        workerGroup = new NioEventLoopGroup(ioWorker, NamedThreadFactory.withName(jmxName + "-io"));
 
         bootstrap.group(bossGroup, workerGroup);
 
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 1da9ce6..ec8a20a 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -113,7 +113,6 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
 
     protected Encryption encryption;
 
-    protected String jmxName;
 
     private String[] enabledCipherSuites;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org