From 65c45756d70d066831a2dd5ac4f8c0949d7d44c8 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sat, 3 Apr 2021 02:22:17 +0200 Subject: [PATCH] More aggressive low memory mode --- .../dbengine/database/disk/LLLocalLuceneIndex.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalLuceneIndex.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalLuceneIndex.java index 5f0a94f..783b813 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalLuceneIndex.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalLuceneIndex.java @@ -92,7 +92,7 @@ public class LLLocalLuceneIndex implements LLLuceneIndex { "lucene-" + name, 60 ); - private final Supplier lowMemorySchedulerSupplier = Suppliers.memoize(() -> + private static final Supplier lowMemorySchedulerSupplier = Suppliers.memoize(() -> Schedulers.newBoundedElastic(1, Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, "lucene-low-memory", Integer.MAX_VALUE))::get; private final Supplier querySchedulerSupplier = USE_STANDARD_SCHEDULERS ? @@ -160,12 +160,13 @@ public class LLLocalLuceneIndex implements LLLuceneIndex { this.searcherManager = new SearcherManager(indexWriter, false, false, null); if (lowMemory) { - this.luceneQueryScheduler = this.luceneBlockingScheduler = lowMemorySchedulerSupplier.get(); + this.luceneQueryScheduler = this.luceneBlockingScheduler = blockingLuceneSearchScheduler + = lowMemorySchedulerSupplier.get(); } else { this.luceneBlockingScheduler = blockingSchedulerSupplier.get(); this.luceneQueryScheduler = querySchedulerSupplier.get(); + this.blockingLuceneSearchScheduler = blockingLuceneSearchSchedulerSupplier.get(); } - this.blockingLuceneSearchScheduler = blockingLuceneSearchSchedulerSupplier.get(); // Create scheduled tasks lifecycle manager this.scheduledTasksLifecycle = new ScheduledTaskLifecycle();