zhaojiandong commented on a change in pull request #6251: fix opentsdb emitter 
always be running
URL: https://github.com/apache/incubator-druid/pull/6251#discussion_r213538511
 
 

 ##########
 File path: 
extensions-contrib/opentsdb-emitter/src/main/java/io/druid/emitter/opentsdb/OpentsdbSender.java
 ##########
 @@ -109,13 +141,11 @@ private void sendEvents()
     @Override
     public void run()
     {
-      while (running) {
-        if (!eventQueue.isEmpty()) {
-          OpentsdbEvent event = eventQueue.poll();
-          events.add(event);
-          if (events.size() >= flushThreshold) {
-            sendEvents();
-          }
+      while (!eventQueue.isEmpty() && !scheduler.isShutdown()) {
+        OpentsdbEvent event = eventQueue.poll();
+        events.add(event);
+        if (events.size() >= flushThreshold) {
+          sendEvents();
 
 Review comment:
   If emitter has large amounts data continuously, eventQueue always has 
element, this will be multiple EventConsumer tasks at the same time. The object 
events is a List<OpentsdbEvent>, it's not safe when multiple tasks use it.

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


With regards,
Apache Git Services

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

Reply via email to