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



##########
File path: 
core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java
##########
@@ -29,33 +29,30 @@
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ThreadPools {
 
+  private static final Logger LOG = LoggerFactory.getLogger(ThreadPools.class);
+
   // the number of seconds before we allow a thread to terminate with non-use.
   public static final long DEFAULT_TIMEOUT_MILLISECS = 180000L;
 
-  private static void makeResizeable(final ThreadPoolExecutor pool,
-      final AccumuloConfiguration conf, final Property p) {
-    final String threadName = p.name().concat("_watcher");
-    Threads.createThread(threadName, () -> {
-      int count = conf.getCount(p);
-      while (Thread.currentThread().isAlive() && 
!Thread.currentThread().isInterrupted()) {
-        try {
-          Thread.sleep(1000);
-          int newCount = conf.getCount(p);
-          if (newCount != count) {
-            pool.setCorePoolSize(newCount);
-            pool.setMaximumPoolSize(newCount);
-            count = newCount;
-          }
-        } catch (InterruptedException e) {
-          // throw a RuntimeException and let the 
AccumuloUncaughtExceptionHandler deal with it.
-          throw new RuntimeException("Thread " + threadName + " was 
interrupted.");
-        }
-      }
-    }).start();
-
+  public static void makeResizeable(final ThreadPoolExecutor pool, final 
AccumuloConfiguration conf,

Review comment:
       I included this in 8bed9e5.

##########
File path: 
core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java
##########
@@ -29,33 +29,30 @@
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ThreadPools {
 
+  private static final Logger LOG = LoggerFactory.getLogger(ThreadPools.class);
+
   // the number of seconds before we allow a thread to terminate with non-use.
   public static final long DEFAULT_TIMEOUT_MILLISECS = 180000L;
 
-  private static void makeResizeable(final ThreadPoolExecutor pool,
-      final AccumuloConfiguration conf, final Property p) {
-    final String threadName = p.name().concat("_watcher");
-    Threads.createThread(threadName, () -> {
-      int count = conf.getCount(p);
-      while (Thread.currentThread().isAlive() && 
!Thread.currentThread().isInterrupted()) {
-        try {
-          Thread.sleep(1000);
-          int newCount = conf.getCount(p);
-          if (newCount != count) {
-            pool.setCorePoolSize(newCount);
-            pool.setMaximumPoolSize(newCount);
-            count = newCount;
-          }
-        } catch (InterruptedException e) {
-          // throw a RuntimeException and let the 
AccumuloUncaughtExceptionHandler deal with it.
-          throw new RuntimeException("Thread " + threadName + " was 
interrupted.");
-        }
-      }
-    }).start();
-
+  public static void makeResizeable(final ThreadPoolExecutor pool, final 
AccumuloConfiguration conf,
+      final Property p) {
+    int count = pool.getMaximumPoolSize();
+    int newCount = conf.getCount(p);

Review comment:
       I included this in 8bed9e5.




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