Skip to content

Commit cb38058

Browse files
committed
fix: the executor service now uses SynchronousQueue
The current approach used a non-bound queue, therefore the thread were not added dynamically into the Threadpool Signed-off-by: Attila Mészáros <csviri@gmail.com>
1 parent 6d24455 commit cb38058

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ExecutorServiceManager.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@
33
import java.time.Duration;
44
import java.util.Collection;
55
import java.util.List;
6-
import java.util.concurrent.Callable;
7-
import java.util.concurrent.ExecutionException;
8-
import java.util.concurrent.ExecutorService;
9-
import java.util.concurrent.Executors;
10-
import java.util.concurrent.Future;
11-
import java.util.concurrent.LinkedBlockingDeque;
12-
import java.util.concurrent.ThreadPoolExecutor;
13-
import java.util.concurrent.TimeUnit;
14-
import java.util.concurrent.TimeoutException;
6+
import java.util.concurrent.*;
157
import java.util.function.Function;
168
import java.util.stream.Collectors;
179
import java.util.stream.Stream;
@@ -37,9 +29,8 @@ public class ExecutorServiceManager {
3729
public static ExecutorService newThreadPoolExecutor(int minThreads, int maxThreads) {
3830
minThreads = Utils.ensureValid(minThreads, "minimum number of threads", MIN_THREAD_NUMBER);
3931
maxThreads = Utils.ensureValid(maxThreads, "maximum number of threads", minThreads + 1);
40-
4132
return new ThreadPoolExecutor(minThreads, maxThreads, 1, TimeUnit.MINUTES,
42-
new LinkedBlockingDeque<>());
33+
new SynchronousQueue<>());
4334
}
4435

4536
/**

0 commit comments

Comments
 (0)