From grepcode Executors and ForkJoinPool
Executors . newWorkStealingPool returns ForkJoinPool
Performers:
public static ExecutorService newWorkStealingPool() { return new ForkJoinPool (Runtime.getRuntime().availableProcessors(), ForkJoinPool.defaultForkJoinWorkerThreadFactory, null, true); }
ForkJoinPool:
public ForkJoinPool(int parallelism, ForkJoinWorkerThreadFactory factory, UncaughtExceptionHandler handler, boolean asyncMode) { this(checkParallelism(parallelism), checkFactory(factory), handler, asyncMode ? FIFO_QUEUE : LIFO_QUEUE, "ForkJoinPool-" + nextPoolId() + "-worker-"); checkPermission(); }
On execute() :
public void execute(ForkJoinTask<?> task) { if (task == null) throw new NullPointerException(); externalPush(task); }
externalPush calls externalSubmit , and you can see the details of WorkQueue in this implementation.
externalSubmit:
// External operations
More information on queue sizes can be found in the WorkQueue class.
static final class WorkQueue {
WokrQueue Documentation:
@sun.misc.Contended static final int INITIAL_QUEUE_CAPACITY = 1 << 13; static final int MAXIMUM_QUEUE_CAPACITY = 1 << 26;
source share