mkapalka commented on code in PR #2410:
URL: https://github.com/apache/jackrabbit-oak/pull/2410#discussion_r2245590635


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/ElasticResultRowAsyncIterator.java:
##########
@@ -176,7 +214,10 @@ public boolean on(Hit<ObjectNode> searchHit) {
     @Override
     public void endData() {
         try {
-            queue.put(POISON_PILL);
+            boolean success = queue.offer(POISON_PILL, enqueueTimeoutMs, 
TimeUnit.MILLISECONDS);
+            if (!success) {
+                LOG.warn("Timeout waiting to insert poison pill into the 
iterator queue. The iterator might not be closed properly.");

Review Comment:
   When this happens, the following call to `hasNext` will time out and throw 
an exception. I'm wondering if it's not better to throw an exception here 
directly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: oak-dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to