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 b2d9f9e142d6c8be12ad656d94facffe5917c77f
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Mon Mar 21 10:33:12 2022 +0700

    JAMES-3715 Close opened channels
    
    See https://github.com/apache/james-project/pull/898 for graceful shutdown
---
 .../apache/james/protocols/netty/AbstractAsyncServer.java   | 13 +++++++------
 1 file changed, 7 insertions(+), 6 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 eefeff6..1e6bdb2 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
@@ -136,19 +136,20 @@ public abstract class AbstractAsyncServer implements 
ProtocolServer {
             workerGroup.shutdownGracefully();
         }
 
+        if (channels != null) {
+            channels.close();
+        }
+
         started = false;
     }
 
     @Override
     public synchronized List<InetSocketAddress> getListenAddresses() {
-        ImmutableList.Builder<InetSocketAddress> builder = 
ImmutableList.builder();
-        for (Channel channel : ImmutableList.copyOf(channels.iterator())) {
-            builder.add((InetSocketAddress) channel.localAddress());
-        }
-        return builder.build();
+        return channels.stream()
+            .map(channel -> (InetSocketAddress) channel.localAddress())
+            .collect(ImmutableList.toImmutableList());
     }
     
-    
     /**
      * Create ChannelPipelineFactory to use by this Server implementation
      */

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

Reply via email to