dlmarion commented on a change in pull request #2278:
URL: https://github.com/apache/accumulo/pull/2278#discussion_r713172844



##########
File path: 
server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
##########
@@ -323,16 +323,11 @@ public static ThreadPoolExecutor 
createSelfResizingThreadPool(final String serve
       // however, this isn't really an issue, since it adjusts periodically 
anyway
       if (pool.getCorePoolSize() <= pool.getActiveCount()) {
         int larger = pool.getCorePoolSize() + Math.min(pool.getQueue().size(), 
2);
-        log.info("Increasing server thread pool size on {} to {}", serverName, 
larger);
-        pool.setMaximumPoolSize(larger);
-        pool.setCorePoolSize(larger);
+        ThreadPools.resizePool(pool, () -> larger, serverName + "-ClientPool");
       } else {
         if (pool.getCorePoolSize() > pool.getActiveCount() + 3) {
           int smaller = Math.max(executorThreads, pool.getCorePoolSize() - 1);
-          if (smaller != pool.getCorePoolSize()) {
-            log.info("Decreasing server thread pool size on {} to {}", 
serverName, smaller);
-            pool.setCorePoolSize(smaller);
-          }
+          ThreadPools.resizePool(pool, () -> smaller, serverName + 
"-ClientPool");

Review comment:
       I can't say about before my change, but in ThreadPools.java as it is 
now, if the thread pool was created with a pool size of 5 and no max pool 
specified, then the max pool size would also be set to 5. If the core pool size 
was then decreased, it would error.
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to