Reputation: 25
Suppose I want to run 10 threads at a time, I would accomplish that by doing something along the lines of:
ExecutorService pool = Executors.newFixedThreadPool(10);
Is it possible to change the amount of threads to 15 using ExecutorService? So the default will be 10, but can I redeclare it to be a fixedthreadpool of 15?
Thanks!
Upvotes: 0
Views: 81
Reputation: 53694
Assuming you mean "at runtime", you can cast the pool to ThreadPoolExecutor
and call setMaximumPoolSize
and setCorePoolSize
.
Upvotes: 1