This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new e1ac8553f4 Clear list of early executor services after binding to 
registry (#5610)
e1ac8553f4 is described below

commit e1ac8553f42692bc22c0bea299bd966f9069456f
Author: Dave Marion <[email protected]>
AuthorDate: Mon Jun 2 17:43:34 2025 -0400

    Clear list of early executor services after binding to registry (#5610)
    
    This change just clears the list of the executor services that
    were created before the MeterRegistry, after they are finally
    added to the MeterRegistry.
---
 .../java/org/apache/accumulo/core/util/threads/ThreadPools.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java 
b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java
index e0c8873198..06e654ffa4 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/threads/ThreadPools.java
@@ -262,6 +262,9 @@ public class ThreadPools {
   }
 
   private final UncaughtExceptionHandler handler;
+  private final AtomicBoolean metricsEnabled = new AtomicBoolean(true);
+  private final AtomicReference<MeterRegistry> registry = new 
AtomicReference<>();
+  private final List<ExecutorServiceMetrics> earlyExecutorServices = new 
ArrayList<>();
 
   private ThreadPools(UncaughtExceptionHandler ueh) {
     handler = ueh;
@@ -724,10 +727,6 @@ public class ThreadPools {
     return result;
   }
 
-  private final AtomicBoolean metricsEnabled = new AtomicBoolean(true);
-  private final AtomicReference<MeterRegistry> registry = new 
AtomicReference<>();
-  private final List<ExecutorServiceMetrics> earlyExecutorServices = new 
ArrayList<>();
-
   private void addExecutorServiceMetrics(ExecutorService executor, String 
name) {
     if (!metricsEnabled.get()) {
       return;
@@ -747,6 +746,7 @@ public class ThreadPools {
     if (registry.compareAndSet(null, r)) {
       synchronized (earlyExecutorServices) {
         earlyExecutorServices.forEach(e -> e.bindTo(r));
+        earlyExecutorServices.clear();
       }
     } else {
       throw new IllegalStateException("setMeterRegistry called more than 
once");

Reply via email to