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



##########
File path: core/src/main/java/org/apache/accumulo/fate/Fate.java
##########
@@ -228,24 +233,25 @@ public void startTransactionRunners(AccumuloConfiguration 
conf) {
         Property.MANAGER_FATE_THREADPOOL_SIZE);
     fatePoolWatcher = ThreadPools.createGeneralScheduledExecutorService(conf);
     fatePoolWatcher.schedule(() -> {
+      // resize the pool if the property changed
       ThreadPools.resizePool(pool, conf, 
Property.MANAGER_FATE_THREADPOOL_SIZE);
-      // Assume a thread could execute up to 100 operations a second.
-      // We are sleeping for three seconds. So to calculate max to queue do 3* 
100 * numThreads.
-      int maxToQueue = 300 * 
conf.getCount(Property.MANAGER_FATE_THREADPOOL_SIZE);
-      int remaining = maxToQueue - pool.getQueue().size();
-      for (int i = 0; i < remaining; i++) {
-        try {
-          pool.execute(new TransactionRunner());
-        } catch (RejectedExecutionException e) {
-          // RejectedExecutionException could be shutting down
-          if (pool.isShutdown()) {
-            // The exception is expected in this case, no need to spam the 
logs.
-            log.trace("Error adding transaction runner to FaTE executor 
pool.", e);
-          } else {
-            // This is bad, FaTE may no longer work!
-            log.error("Error adding transaction runner to FaTE executor 
pool.", e);
+      // If the pool grew, then ensure that there is a TransactionRunner for 
each thread
+      int needed = conf.getCount(Property.MANAGER_FATE_THREADPOOL_SIZE) - 
pool.getQueue().size();
+      if (needed > 0) {

Review comment:
       The call to `ThreadPools.resizePool` will either increase or decrease 
the number of Threads in the pool depending on the current value of the 
Property.




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