You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/08/28 15:38:24 UTC

[GitHub] gianm commented on a change in pull request #6254: fix opentsdb emitter occupy 100%(#6247)

gianm commented on a change in pull request #6254: fix opentsdb emitter occupy 100%(#6247)
URL: https://github.com/apache/incubator-druid/pull/6254#discussion_r213366682
 
 

 ##########
 File path: extensions-contrib/opentsdb-emitter/src/main/java/io/druid/emitter/opentsdb/OpentsdbSender.java
 ##########
 @@ -110,12 +119,15 @@ private void sendEvents()
     public void run()
     {
       while (running) {
-        if (!eventQueue.isEmpty()) {
-          OpentsdbEvent event = eventQueue.poll();
+        try {
+          OpentsdbEvent event = eventQueue.take();
           events.add(event);
-          if (events.size() >= flushThreshold) {
-            sendEvents();
-          }
+        }
+        catch (InterruptedException e) {
+          log.error(e, "consumer take event failed!");
+        }
+        if (events.size() >= flushThreshold) {
+          sendEvents();
 
 Review comment:
   `take` will block until an item becomes available, so I think it is okay. This function will spend most of its time waiting on `take` rather than in a spin loop.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org