这是 ForkJoinPool 默认构造函数。
public ForkJoinPool() {
this(Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()),
defaultForkJoinWorkerThreadFactory, null, false);
}
这都是参数构造函数。
public ForkJoinPool(int parallelism,
ForkJoinWorkerThreadFactory factory,
UncaughtExceptionHandler handler,
boolean asyncMode)
MAX_CAP 是
static final int MAX_CAP = 0x7fff; // max #workers - 1
为什么限制 MAX_CAP 和 0x7fff 有特殊意义?