Fixed #1796 - ReservedThreadExecutor defaulting to capacity=1 only.
Using getMaxThreads() instead of getThreads().
This commit is contained in:
parent
fb86b8e54f
commit
ec9a4ecdc1
|
@ -60,15 +60,15 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements Executo
|
|||
|
||||
if (capacity < 0)
|
||||
{
|
||||
if (executor instanceof ThreadPool)
|
||||
int cpus = Runtime.getRuntime().availableProcessors();
|
||||
if (executor instanceof ThreadPool.SizedThreadPool)
|
||||
{
|
||||
int threads = ((ThreadPool)executor).getThreads();
|
||||
int cpus = Runtime.getRuntime().availableProcessors();
|
||||
capacity = Math.max(1,Math.min(cpus,threads/8));
|
||||
int threads = ((ThreadPool.SizedThreadPool)executor).getMaxThreads();
|
||||
capacity = Math.max(1, Math.min(cpus, threads / 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
capacity = Runtime.getRuntime().availableProcessors();
|
||||
capacity = cpus;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue