restore actual count value (for IDEA-CR-41523)

This commit is contained in:
Alexey Kudravtsev
2018-12-20 15:54:21 +03:00
parent d2cc652835
commit 08250139b4
2 changed files with 5 additions and 3 deletions
@@ -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<Runnable>(), new CountingThreadFactory() {
@@ -34,6 +32,6 @@ public class ProcessIOExecutorService extends ThreadPoolExecutor {
@TestOnly
public int getThreadCounter() {
return counter.get();
return ((CountingThreadFactory)getThreadFactory()).getCount();
}
}
@@ -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();
}
}