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:56 UTC

[james-project] 25/29: JAMES-3715 ChannelGroups: rely on immediate executor

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 27ab3a45bb3e5f354bb1d441804aa8a53d10e088
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Mar 21 10:27:54 2022 +0700

    JAMES-3715 ChannelGroups: rely on immediate executor
    
    'GlobalEventExecutor' states - please note it is not scalable to schedule large number of tasks to this executor; use a dedicated executor.
    
    Projects like Reactor Netty use ImmediateEventExecutor.INSTANCE so I'd potentially recommend changing to;
    
        private final ChannelGroup channels = new DefaultChannelGroup(ImmediateEventExecutor.INSTANCE);
    
    This will then just execute actions against the channel group on the current thread.
---
 .../java/org/apache/james/protocols/netty/AbstractAsyncServer.java   | 5 ++---
 1 file changed, 2 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 cd95677..eefeff6 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
@@ -37,8 +37,7 @@ import io.netty.channel.group.DefaultChannelGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.util.concurrent.GlobalEventExecutor;
-
+import io.netty.util.concurrent.ImmediateEventExecutor;
 
 
 /**
@@ -56,7 +55,7 @@ public abstract class AbstractAsyncServer implements ProtocolServer {
 
     private volatile boolean started;
     
-    private final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
+    private final ChannelGroup channels = new DefaultChannelGroup(ImmediateEventExecutor.INSTANCE);
 
     private volatile int ioWorker = DEFAULT_IO_WORKER_COUNT;
     

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