You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2021/06/02 03:47:56 UTC

[GitHub] [zookeeper] kyangcmXF commented on a change in pull request #1705: ZOOKEEPER-4309 QuorumCnxManager's ListenerHandler thread leak

kyangcmXF commented on a change in pull request #1705:
URL: https://github.com/apache/zookeeper/pull/1705#discussion_r643631348



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
##########
@@ -957,8 +957,13 @@ public void run() {
                                 new ListenerHandler(address, self.shouldUsePortUnification(), self.isSslQuorum(), latch))
                         .collect(Collectors.toList());
 
-                ExecutorService executor = Executors.newFixedThreadPool(addresses.size());
-                listenerHandlers.forEach(executor::submit);
+                final ExecutorService executor = Executors.newFixedThreadPool(addresses.size());

Review comment:
       > what about creating a shared ExecutorService, as a field in this class ?
   > this way it will be clearer the life cycle of this pool.
   > 
   > also, probably it would be worth to not use a pool in case of a list of addresses of size 1, but this may be a follow up work
   
   we can use a global shared thread pool just as what we do in spring. For example we use @component annotation to register a pool. 
   however there's a question we need figure it out if the pool is io computed pool or a  cpu computed pool. 
   I think that is io computed pool because we use to accept ticket there. 
   @eolivelli 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org