diff --git a/platform/util/src/com/intellij/execution/process/ProcessIOExecutorService.java b/platform/util/src/com/intellij/execution/process/ProcessIOExecutorService.java index 33c54ecb309f..288dc5cc9d03 100644 --- a/platform/util/src/com/intellij/execution/process/ProcessIOExecutorService.java +++ b/platform/util/src/com/intellij/execution/process/ProcessIOExecutorService.java @@ -17,8 +17,6 @@ import java.util.concurrent.atomic.AtomicInteger; public class ProcessIOExecutorService extends ThreadPoolExecutor { public static final String POOLED_THREAD_PREFIX = "Process I/O pool "; public static final ExecutorService INSTANCE = new ProcessIOExecutorService(); - private final AtomicInteger counter = new AtomicInteger(); - private ProcessIOExecutorService() { super(1, Integer.MAX_VALUE, 1, TimeUnit.MINUTES, new SynchronousQueue(), new CountingThreadFactory() { @@ -34,6 +32,6 @@ public class ProcessIOExecutorService extends ThreadPoolExecutor { @TestOnly public int getThreadCounter() { - return counter.get(); + return ((CountingThreadFactory)getThreadFactory()).getCount(); } } diff --git a/platform/util/src/com/intellij/util/concurrency/CountingThreadFactory.java b/platform/util/src/com/intellij/util/concurrency/CountingThreadFactory.java index c765f817e2ee..19b54ee1e8dd 100644 --- a/platform/util/src/com/intellij/util/concurrency/CountingThreadFactory.java +++ b/platform/util/src/com/intellij/util/concurrency/CountingThreadFactory.java @@ -6,4 +6,8 @@ import java.util.concurrent.atomic.AtomicInteger; public abstract class CountingThreadFactory implements ThreadFactory { protected final AtomicInteger counter = new AtomicInteger(); + + public int getCount() { + return counter.get(); + } }