leventov commented on a change in pull request #7038: Fix and document 
concurrency of EventReceiverFirehose and TimedShutoffFirehose; Refine 
concurrency specification of Firehose
URL: https://github.com/apache/incubator-druid/pull/7038#discussion_r255674554
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/segment/realtime/firehose/EventReceiverFirehoseFactory.java
 ##########
 @@ -274,67 +359,59 @@ public Response addAll(
       }
       catch (InterruptedException e) {
         Thread.currentThread().interrupt();
-        throw Throwables.propagate(e);
-      }
-      catch (JsonProcessingException e) {
-        throw Throwables.propagate(e);
+        throw new RuntimeException(e);
       }
     }
 
     @Override
     public boolean hasMore()
     {
-      synchronized (readLock) {
-        try {
-          while (nextRow == null) {
-            nextRow = buffer.poll(500, TimeUnit.MILLISECONDS);
-            if (closed) {
-              break;
-            }
-          }
-        }
-        catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-          throw Throwables.propagate(e);
-        }
-
-        return nextRow != null;
+      if (rowsRunOut) {
+        return false;
       }
+      if (nextRow != null) {
+        return true;
+      }
+      Object next;
+      try {
+        next = buffer.take();
 
 Review comment:
   I extended comment for `buffer` field a little.
   
   Simply checking `closed` flag is a race condition without a heuristic loop, 
similar to what existed before.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to