From 3180b751ef9cc8df3a24bbc420e4917c3d35ac29 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Wed, 29 Mar 2023 16:33:33 +0200 Subject: [PATCH] Fifo workers --- .../java/it/cavallium/dbengine/utils/StreamUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/utils/StreamUtils.java b/src/main/java/it/cavallium/dbengine/utils/StreamUtils.java index 09988ee..bf04b97 100644 --- a/src/main/java/it/cavallium/dbengine/utils/StreamUtils.java +++ b/src/main/java/it/cavallium/dbengine/utils/StreamUtils.java @@ -37,11 +37,11 @@ import org.jetbrains.annotations.Nullable; public class StreamUtils { - public static final ForkJoinPool LUCENE_POOL = newNamedForkJoinPool("Lucene"); + public static final ForkJoinPool LUCENE_POOL = newNamedForkJoinPool("Lucene", false); - public static final ForkJoinPool GRAPH_POOL = newNamedForkJoinPool("Graph"); + public static final ForkJoinPool GRAPH_POOL = newNamedForkJoinPool("Graph", false); - public static final ForkJoinPool ROCKSDB_POOL = newNamedForkJoinPool("RocksDB"); + public static final ForkJoinPool ROCKSDB_POOL = newNamedForkJoinPool("RocksDB", false); private static final Collector TO_LIST_FAKE_COLLECTOR = new FakeCollector(); private static final Collector COUNT_FAKE_COLLECTOR = new FakeCollector(); @@ -59,13 +59,13 @@ public class StreamUtils { private static final Function FINISHER = x -> null; private static final Collector SUMMING_LONG_COLLECTOR = new SummingLongCollector(); - public static ForkJoinPool newNamedForkJoinPool(String name) { + public static ForkJoinPool newNamedForkJoinPool(String name, boolean fifo) { final int MAX_CAP = 0x7fff; // max #workers - 1 return new ForkJoinPool( Math.min(MAX_CAP, Runtime.getRuntime().availableProcessors()), new NamedForkJoinWorkerThreadFactory(name), null, - true, + fifo, 0, MAX_CAP, 1,