From d2e7c56f06e3a999be7ba29f51b112a78cdd636b Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Mon, 20 Jun 2022 12:30:33 +0200 Subject: [PATCH] Use more method references --- .../cavallium/dbengine/database/LLUtils.java | 16 ++++++-- .../database/collections/DatabaseInt.java | 3 +- .../database/collections/DatabaseLong.java | 5 ++- .../collections/DatabaseMapDictionary.java | 20 +++++----- .../DatabaseMapDictionaryDeep.java | 4 +- .../collections/DatabaseMapSingle.java | 8 ++-- .../collections/DatabaseSingleton.java | 8 ++-- .../database/disk/LLLocalDictionary.java | 38 +++++++++---------- .../database/disk/LLLocalSingleton.java | 4 +- .../database/memory/LLMemoryDictionary.java | 24 ++++++------ .../lucene/searcher/CountMultiSearcher.java | 2 +- 11 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/LLUtils.java b/src/main/java/it/cavallium/dbengine/database/LLUtils.java index 7026a67..e70ef72 100644 --- a/src/main/java/it/cavallium/dbengine/database/LLUtils.java +++ b/src/main/java/it/cavallium/dbengine/database/LLUtils.java @@ -643,11 +643,21 @@ public class LLUtils { } public static Mono finalizeResource(Resource resource) { - return Mono.fromRunnable(() -> LLUtils.closeResource(resource)); + return Mono.fromRunnable(() -> LLUtils.finalizeResourceNow(resource)); } public static Mono finalizeResource(SimpleResource resource) { - return Mono.fromRunnable(() -> LLUtils.closeResource(resource)); + return Mono.fromRunnable(resource::close); + } + + public static void finalizeResourceNow(Resource resource) { + if (resource.isAccessible()) { + resource.close(); + } + } + + public static void finalizeResourceNow(SimpleResource resource) { + resource.close(); } public static Flux handleDiscard(Flux flux) { @@ -869,7 +879,7 @@ public class LLUtils { newCurr = null; } return new Delta<>(newPrev, newCurr); - }), delta -> Mono.fromRunnable(delta::close)); + }), LLUtils::finalizeResource); } public static boolean isDeltaChanged(Delta delta) { diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseInt.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseInt.java index e6ea801..ef1be2a 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseInt.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseInt.java @@ -4,6 +4,7 @@ import com.google.common.primitives.Ints; import it.cavallium.dbengine.database.LLKeyValueDatabaseStructure; import it.cavallium.dbengine.database.LLSingleton; import it.cavallium.dbengine.database.LLSnapshot; +import it.cavallium.dbengine.database.LLUtils; import it.cavallium.dbengine.database.serialization.SerializationException; import it.cavallium.dbengine.database.serialization.SerializerFixedBinaryLength; import org.jetbrains.annotations.Nullable; @@ -23,7 +24,7 @@ public class DatabaseInt implements LLKeyValueDatabaseStructure { var resultMono = singleton.get(snapshot); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> serializer.deserialize(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseLong.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseLong.java index 5694884..a26aeb2 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseLong.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseLong.java @@ -5,6 +5,7 @@ import com.google.common.primitives.Longs; import it.cavallium.dbengine.database.LLKeyValueDatabaseStructure; import it.cavallium.dbengine.database.LLSingleton; import it.cavallium.dbengine.database.LLSnapshot; +import it.cavallium.dbengine.database.LLUtils; import it.cavallium.dbengine.database.UpdateReturnMode; import it.cavallium.dbengine.database.serialization.SerializationException; import it.cavallium.dbengine.database.serialization.SerializerFixedBinaryLength; @@ -33,7 +34,7 @@ public class DatabaseLong implements LLKeyValueDatabaseStructure { return serializer.deserialize(result); } }), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -80,7 +81,7 @@ public class DatabaseLong implements LLKeyValueDatabaseStructure { }, updateReturnMode); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(result::readLong), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ).single(); } diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java index 13282ae..c9fc4ba 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapDictionary.java @@ -274,7 +274,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeKeySuffixToKey(keySuffix))), value -> Mono.fromCallable(() -> deserializeValue(keySuffix, value)), - value -> Mono.fromRunnable(value::close)); + LLUtils::finalizeResource); } @Override @@ -283,7 +283,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeValue(value)).single(); return Mono.usingWhen(dictionary.put(keyMono, valueMono, LLDictionaryResultType.VOID), v -> Mono.empty(), - v -> Mono.fromRunnable(v::close) + LLUtils::finalizeResource ); } @@ -298,7 +298,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeKeySuffixToKey(keySuffix)); return Mono.usingWhen(dictionary.update(keyMono, getSerializedUpdater(updater), updateReturnMode), result -> Mono.fromCallable(() -> deserializeValue(keySuffix, result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -355,7 +355,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeValue(value)); return Mono.usingWhen(dictionary.put(keyMono, valueMono, LLDictionaryResultType.PREVIOUS_VALUE), valueBuf -> Mono.fromCallable(() -> deserializeValue(keySuffix, valueBuf)), - valueBuf -> Mono.fromRunnable(valueBuf::close) + LLUtils::finalizeResource ); } @@ -366,7 +366,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep Mono.fromCallable(() -> deserializeValue(keySuffix, valueBuf)), - valueBuf -> Mono.fromRunnable(valueBuf::close) + LLUtils::finalizeResource ) .map(oldValue -> !Objects.equals(oldValue, value)) .defaultIfEmpty(value != null); @@ -377,7 +377,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeKeySuffixToKey(keySuffix)); return dictionary .remove(keyMono, LLDictionaryResultType.VOID) - .doOnNext(Resource::close) + .doOnNext(LLUtils::finalizeResourceNow) .then(); } @@ -386,7 +386,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep serializeKeySuffixToKey(keySuffix)); return Mono.usingWhen(dictionary.remove(keyMono, LLDictionaryResultType.PREVIOUS_VALUE), valueBuf -> Mono.fromCallable(() -> deserializeValue(keySuffix, valueBuf)), - valueBuf -> Mono.fromRunnable(valueBuf::close) + LLUtils::finalizeResource ); } @@ -535,7 +535,7 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep boundedRangeMono = Mono.usingWhen(rangeMono, range -> Mono.fromCallable(() -> getPatchedRange(range, keyMin, keyMax)), - range -> Mono.fromRunnable(range::close)); + LLUtils::finalizeResource); return getAllValues(snapshot, boundedRangeMono, reverse, smallRange); } } @@ -580,12 +580,12 @@ public class DatabaseMapDictionary extends DatabaseMapDictionaryDeep> extend } else if (range.isSingle()) { return dictionary .remove(Mono.fromCallable(range::getSingleUnsafe), LLDictionaryResultType.VOID) - .doOnNext(Resource::close) + .doOnNext(LLUtils::finalizeResourceNow) .then(); } else { return dictionary.setRange(rangeMono, Flux.empty(), false); } - }, ResourceSupport::close); + }, LLUtils::finalizeResourceNow); } protected T deserializeSuffix(@NotNull Buffer keySuffix) throws SerializationException { diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapSingle.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapSingle.java index 1c611a2..b68db35 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapSingle.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseMapSingle.java @@ -113,7 +113,7 @@ public class DatabaseMapSingle extends ResourceSupport, Data public Mono get(@Nullable CompositeSnapshot snapshot) { return Mono.usingWhen(dictionary.get(resolveSnapshot(snapshot), keyMono), buf -> Mono.fromSupplier(() -> deserializeValue(buf)), - buf -> Mono.fromRunnable(buf::close) + LLUtils::finalizeResource ); } @@ -122,7 +122,7 @@ public class DatabaseMapSingle extends ResourceSupport, Data return Mono.usingWhen(dictionary .put(keyMono, Mono.fromCallable(() -> serializeValue(value)), LLDictionaryResultType.PREVIOUS_VALUE), buf -> Mono.fromSupplier(() -> deserializeValue(buf)), - buf -> Mono.fromRunnable(buf::close)); + LLUtils::finalizeResource); } @Override @@ -147,7 +147,7 @@ public class DatabaseMapSingle extends ResourceSupport, Data }, updateReturnMode); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -174,7 +174,7 @@ public class DatabaseMapSingle extends ResourceSupport, Data public Mono clearAndGetPrevious() { return Mono.usingWhen(dictionary.remove(keyMono, LLDictionaryResultType.PREVIOUS_VALUE), result -> Mono.fromSupplier(() -> deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } diff --git a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseSingleton.java b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseSingleton.java index 54fe93a..86237f4 100644 --- a/src/main/java/it/cavallium/dbengine/database/collections/DatabaseSingleton.java +++ b/src/main/java/it/cavallium/dbengine/database/collections/DatabaseSingleton.java @@ -104,7 +104,7 @@ public class DatabaseSingleton extends ResourceSupport, Data var resultMono = singleton.get(resolveSnapshot(snapshot)); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> this.deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -120,7 +120,7 @@ public class DatabaseSingleton extends ResourceSupport, Data .last(); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> this.deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -146,7 +146,7 @@ public class DatabaseSingleton extends ResourceSupport, Data }, updateReturnMode); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> this.deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } @@ -181,7 +181,7 @@ public class DatabaseSingleton extends ResourceSupport, Data var resultMono = Flux.concat(singleton.get(null), singleton.set(Mono.empty()).then(Mono.empty())).last(); return Mono.usingWhen(resultMono, result -> Mono.fromSupplier(() -> this.deserializeValue(result)), - result -> Mono.fromRunnable(result::close) + LLUtils::finalizeResource ); } diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java index d68e633..04ef814 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDictionary.java @@ -258,7 +258,7 @@ public class LLLocalDictionary implements LLDictionary { public Mono get(@Nullable LLSnapshot snapshot, Mono keyMono) { return Mono.usingWhen(keyMono, key -> runOnDb(false, () -> this.getSync(snapshot, key)), - key -> Mono.fromRunnable(key::close) + LLUtils::finalizeResource ); } @@ -329,7 +329,7 @@ public class LLLocalDictionary implements LLDictionary { } finally { endedContains.increment(); } - }), range -> Mono.fromRunnable(range::close)); + }), LLUtils::finalizeResource); } private boolean containsKey(@Nullable LLSnapshot snapshot, Buffer key) throws RocksDBException { @@ -454,7 +454,7 @@ public class LLLocalDictionary implements LLDictionary { } throw ex; } - }), key -> Mono.fromRunnable(key::close)); + }), LLUtils::finalizeResource); } @SuppressWarnings("DuplicatedCode") @@ -492,7 +492,7 @@ public class LLLocalDictionary implements LLDictionary { } throw ex; } - }), key -> Mono.fromRunnable(key::close)); + }), LLUtils::finalizeResource); } @Override @@ -516,7 +516,7 @@ public class LLLocalDictionary implements LLDictionary { } catch (RocksDBException ex) { throw new RocksDBException("Failed to delete: " + ex.getMessage()); } - }), key -> Mono.fromRunnable(key::close)); + }), LLUtils::finalizeResource); // Read the previous data, then delete the data, then return the previous data return Flux.concat(previousDataMono, removeMono).singleOrEmpty(); } @@ -526,7 +526,7 @@ public class LLLocalDictionary implements LLDictionary { case PREVIOUS_VALUE_EXISTENCE -> Mono.usingWhen(keyMono, key -> runOnDb(false, () -> { var contained = containsKey(null, key); return LLUtils.booleanToResponseByteBuffer(alloc, contained); - }), key -> Mono.fromRunnable(key::close)); + }), LLUtils::finalizeResource); case PREVIOUS_VALUE -> Mono.usingWhen(keyMono, key -> runOnDb(false, () -> { assert !Schedulers.isInNonBlockingThread() : "Called getPreviousData in a nonblocking thread"; Buffer result; @@ -540,7 +540,7 @@ public class LLLocalDictionary implements LLDictionary { } logger.trace(MARKER_ROCKSDB, "Read {}: {}", () -> toStringSafe(key), () -> toStringSafe(result)); return result; - }), key -> Mono.fromRunnable(key::close)); + }), LLUtils::finalizeResource); case VOID -> Mono.empty(); }; } @@ -671,7 +671,7 @@ public class LLLocalDictionary implements LLDictionary { } } finally { for (var mappedInput : mappedInputs) { - mappedInput.getT3().ifPresent(Resource::close); + mappedInput.getT3().ifPresent(LLUtils::finalizeResourceNow); } } @@ -761,7 +761,7 @@ public class LLLocalDictionary implements LLDictionary { }); return Flux.usingWhen(iteratorMono, iterator -> iterator.flux().subscribeOn(dbRScheduler, false), - iterator -> Mono.fromRunnable(iterator::close) + LLUtils::finalizeResource ); } @@ -780,7 +780,7 @@ public class LLLocalDictionary implements LLDictionary { return Flux.usingWhen( iteratorMono, iterator -> iterator.flux().subscribeOn(dbRScheduler, false), - iterator -> Mono.fromRunnable(iterator::close) + LLUtils::finalizeResource ); } @@ -821,7 +821,7 @@ public class LLLocalDictionary implements LLDictionary { }); return Flux.usingWhen(iteratorMono, iterator -> iterator.flux().subscribeOn(dbRScheduler, false), - iterator -> Mono.fromRunnable(iterator::close) + LLUtils::finalizeResource ); } @@ -860,7 +860,7 @@ public class LLLocalDictionary implements LLDictionary { } }) .subscribeOn(dbRScheduler), - range -> Mono.fromRunnable(range::close) + LLUtils::finalizeResource ); } @@ -880,7 +880,7 @@ public class LLLocalDictionary implements LLDictionary { }); return Flux.usingWhen(iteratorMono, iterator -> iterator.flux().subscribeOn(dbRScheduler), - iterator -> Mono.fromRunnable(iterator::close) + LLUtils::finalizeResource ); } @@ -891,7 +891,7 @@ public class LLLocalDictionary implements LLDictionary { } else { return null; } - }), key -> Mono.fromRunnable(key::close)).flux(); + }), LLUtils::finalizeResource).flux(); } private record RocksObjTuple>(T t1, U t2) implements SafeCloseable { @@ -969,7 +969,7 @@ public class LLLocalDictionary implements LLDictionary { } catch (RocksDBException ex) { throw new RocksDBException("Failed to set a range: " + ex.getMessage()); } - }), range -> Mono.fromRunnable(range::close)) + }), LLUtils::finalizeResource) .thenMany(entries.window(MULTI_GET_WINDOW)) .flatMap(keysWindowFlux -> keysWindowFlux .collectList() @@ -1199,7 +1199,7 @@ public class LLLocalDictionary implements LLDictionary { } catch (RocksDBException ex) { throw new RocksDBException("Failed to get size of range: " + ex.getMessage()); } - }), range -> Mono.fromRunnable(range::close)); + }), LLUtils::finalizeResource); } @Override @@ -1228,7 +1228,7 @@ public class LLLocalDictionary implements LLDictionary { } catch (RocksDBException ex) { throw new RocksDBException("Failed to get one entry: " + ex.getMessage()); } - }), range -> Mono.fromRunnable(range::close)); + }), LLUtils::finalizeResource); } @Override @@ -1253,7 +1253,7 @@ public class LLLocalDictionary implements LLDictionary { } catch (RocksDBException ex) { throw new RocksDBException("Failed to get one key: " + ex.getMessage()); } - }), range -> Mono.fromRunnable(range::close)); + }), LLUtils::finalizeResource); } private long fastSizeAll(@Nullable LLSnapshot snapshot) throws RocksDBException { @@ -1387,7 +1387,7 @@ public class LLLocalDictionary implements LLDictionary { return LLEntry.of(key, value); } } - }), range -> Mono.fromRunnable(range::close)); + }), LLUtils::finalizeResource); } } diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalSingleton.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalSingleton.java index 3a8bebb..89d306d 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalSingleton.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalSingleton.java @@ -151,7 +151,7 @@ public class LLLocalSingleton implements LLSingleton { case GET_OLD_VALUE -> ((UpdateAtomicResultPrevious) result).previous(); }; }).onErrorMap(cause -> new IOException("Failed to read or write", cause)), - keySend -> Mono.fromRunnable(keySend::close)); + LLUtils::finalizeResource); } @Override @@ -166,7 +166,7 @@ public class LLLocalSingleton implements LLSingleton { } return ((UpdateAtomicResultDelta) result).delta(); }).onErrorMap(cause -> new IOException("Failed to read or write", cause)), - keySend -> Mono.fromRunnable(keySend::close)); + LLUtils::finalizeResource); } @Override diff --git a/src/main/java/it/cavallium/dbengine/database/memory/LLMemoryDictionary.java b/src/main/java/it/cavallium/dbengine/database/memory/LLMemoryDictionary.java index 8f232e8..54c98bf 100644 --- a/src/main/java/it/cavallium/dbengine/database/memory/LLMemoryDictionary.java +++ b/src/main/java/it/cavallium/dbengine/database/memory/LLMemoryDictionary.java @@ -184,7 +184,7 @@ public class LLMemoryDictionary implements LLDictionary { .fromCallable(() -> snapshots.get(resolveSnapshot(snapshot)).get(kShr(key))) .map(this::kkB) .onErrorMap(cause -> new IOException("Failed to read", cause)), - key -> Mono.fromRunnable(key::close) + LLUtils::finalizeResource ); } @@ -238,7 +238,7 @@ public class LLMemoryDictionary implements LLDictionary { var oldVal = oldRef.get(); return LLDelta.of(oldVal != null ? kkB(oldRef.get()) : null, newValue != null ? kkB(newValue) : null); }), - key -> Mono.fromRunnable(key::close) + LLUtils::finalizeResource ); } @@ -266,7 +266,7 @@ public class LLMemoryDictionary implements LLDictionary { } })) .onErrorMap(cause -> new IOException("Failed to read", cause)), - key -> Mono.fromRunnable(key::close) + LLUtils::finalizeResource ); } @@ -330,7 +330,7 @@ public class LLMemoryDictionary implements LLDictionary { }) .map(entry -> LLEntry.of(kkB(entry.getKey()), kkB(entry.getValue()))); } - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } @Override @@ -362,7 +362,7 @@ public class LLMemoryDictionary implements LLDictionary { ); } } - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } @Override @@ -397,7 +397,7 @@ public class LLMemoryDictionary implements LLDictionary { .map(this::kkB); } }, - range -> Mono.fromRunnable(range::close) + LLUtils::finalizeResource ); } @@ -434,7 +434,7 @@ public class LLMemoryDictionary implements LLDictionary { ); } } - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } @SuppressWarnings("RedundantCast") @@ -466,7 +466,7 @@ public class LLMemoryDictionary implements LLDictionary { .map(this::kkB); } } - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } @Override @@ -503,7 +503,7 @@ public class LLMemoryDictionary implements LLDictionary { } }) .then(); - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } private boolean isInsideRange(BLRange range, ByteList key) { @@ -528,7 +528,7 @@ public class LLMemoryDictionary implements LLDictionary { @Override public Mono isRangeEmpty(@Nullable LLSnapshot snapshot, Mono rangeMono, boolean fillCache) { return getRangeKeys(snapshot, rangeMono, false, false) - .doOnNext(Resource::close) + .doOnNext(LLUtils::finalizeResourceNow) .count() .map(count -> count == 0); } @@ -537,7 +537,7 @@ public class LLMemoryDictionary implements LLDictionary { public Mono sizeRange(@Nullable LLSnapshot snapshot, Mono rangeMono, boolean fast) { return Mono.usingWhen(rangeMono, range -> Mono.fromCallable(() -> (long) mapSlice(snapshot, range).size()), - range -> Mono.fromRunnable(range::close) + LLUtils::finalizeResource ); } @@ -587,7 +587,7 @@ public class LLMemoryDictionary implements LLDictionary { .map(entry -> LLEntry.of(kkB(entry.getKey()), kkB(entry.getValue()))); } } - }, range -> Mono.fromRunnable(range::close)); + }, LLUtils::finalizeResource); } @Override diff --git a/src/main/java/it/cavallium/dbengine/lucene/searcher/CountMultiSearcher.java b/src/main/java/it/cavallium/dbengine/lucene/searcher/CountMultiSearcher.java index 55817db..5296cf4 100644 --- a/src/main/java/it/cavallium/dbengine/lucene/searcher/CountMultiSearcher.java +++ b/src/main/java/it/cavallium/dbengine/lucene/searcher/CountMultiSearcher.java @@ -74,7 +74,7 @@ public class CountMultiSearcher implements MultiSearcher { .take(queryParams2.limitLong(), true); return new LuceneSearchResult(totalHitsCount, mergedFluxes, () -> { - resultsToDrop.forEach(SimpleResource::close); + resultsToDrop.forEach(LLUtils::finalizeResourceNow); try { indexSearchers.close(); } catch (IOException e) {