This commit is contained in:
Andrea Cavalli 2023-03-29 16:35:51 +02:00
parent 3180b751ef
commit f54388efa8

View File

@ -59,13 +59,13 @@ public class StreamUtils {
private static final Function<Object, Void> FINISHER = x -> null; private static final Function<Object, Void> FINISHER = x -> null;
private static final Collector<Long,?, Long> SUMMING_LONG_COLLECTOR = new SummingLongCollector(); private static final Collector<Long,?, Long> SUMMING_LONG_COLLECTOR = new SummingLongCollector();
public static ForkJoinPool newNamedForkJoinPool(String name, boolean fifo) { public static ForkJoinPool newNamedForkJoinPool(String name, boolean async) {
final int MAX_CAP = 0x7fff; // max #workers - 1 final int MAX_CAP = 0x7fff; // max #workers - 1
return new ForkJoinPool( return new ForkJoinPool(
Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()), Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()),
new NamedForkJoinWorkerThreadFactory(name), new NamedForkJoinWorkerThreadFactory(name),
null, null,
fifo, async,
0, 0,
MAX_CAP, MAX_CAP,
1, 1,