< prev index next > src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java
Print this page
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.LockSupport;
+ import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.JavaUtilConcurrentFJPAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.Unsafe;
import jdk.internal.vm.SharedThreadContainer;
throw new RejectedExecutionException();
}
private void poolSubmit(boolean signalIfEmpty, ForkJoinTask<?> task) {
Thread t; ForkJoinWorkerThread wt; WorkQueue q; boolean internal;
! if (((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) &&
(wt = (ForkJoinWorkerThread)t).pool == this) {
internal = true;
q = wt.workQueue;
}
else { // find and lock queue
internal = false;
q = submissionQueue(ThreadLocalRandom.getProbe());
}
q.push(task, signalIfEmpty ? this : null, internal);
}
/**
* Returns queue for an external submission, bypassing call to
* submissionQueue if already established and unlocked.
*/
throw new RejectedExecutionException();
}
private void poolSubmit(boolean signalIfEmpty, ForkJoinTask<?> task) {
Thread t; ForkJoinWorkerThread wt; WorkQueue q; boolean internal;
! if (((t = JLA.currentCarrierThread()) instanceof ForkJoinWorkerThread) &&
(wt = (ForkJoinWorkerThread)t).pool == this) {
internal = true;
q = wt.workQueue;
}
else { // find and lock queue
internal = false;
q = submissionQueue(ThreadLocalRandom.getProbe());
}
q.push(task, signalIfEmpty ? this : null, internal);
}
+ private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
/**
* Returns queue for an external submission, bypassing call to
* submissionQueue if already established and unlocked.
*/
< prev index next >