Ensure running in a blocking thread

This commit is contained in:
Andrea Cavalli 2021-09-29 11:38:29 +02:00
parent 74f2cce604
commit 2fb96eaf03
2 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package it.cavallium.dbengine.lucene.collector;
import it.cavallium.dbengine.database.LLUtils;
import java.util.concurrent.locks.LockSupport;
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.search.LeafCollector;
@ -27,6 +28,7 @@ public class ReactiveLeafCollector implements LeafCollector {
@Override
public void collect(int i) {
LLUtils.ensureBlocking();
var scoreDoc = new ScoreDoc(leafReaderContext.docBase + i, 0, shardIndex);
boolean shouldRetry;
do {

View File

@ -53,6 +53,7 @@ public class UnsortedUnscoredContinuousLuceneMultiSearcher implements LuceneMult
return LLUtils.usingSendResource(indexSearchersSendResource,
indexSearchers -> Mono.fromCallable(() -> {
LLUtils.ensureBlocking();
Many<ScoreDoc> scoreDocsSink = Sinks.many().unicast().onBackpressureBuffer(QUEUE_SUPPLIER.get());