Answer the question
In order to leave comments, you need to log in
How to set maximum queue time using Thread Pool Executor?
Is there a way to set a time limit for each request from a queue to a pool?
I have a class that inherits ThreadPoolExecutor
public class TaskPool extends ThreadPoolExecutor {
public TaskPool (int initialCountOfThreads, int maxPollSize) {
super(initialCountOfThreads, maxPollSize, 100, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(150));
}
TaskPool taskPool = new TaskPool(2, 50);
for (int i = 0; i < 50000000; i++) {
task = new Task("Test" + i);
taskPool.execute(task);
}
[email protected]2d6a9952[Running, pool size = 50, active threads = 48, queued tasks = 150, completed tasks = 7430]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question