You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by GitBox <gi...@apache.org> on 2019/10/04 17:14:33 UTC

[GitHub] [incubator-heron] xiaoyao1991 commented on a change in pull request #3355: Add a cap to metrics communicator in TMasterSink and MetricsCacheSink

xiaoyao1991 commented on a change in pull request #3355: Add a cap to metrics communicator in TMasterSink and MetricsCacheSink
URL: https://github.com/apache/incubator-heron/pull/3355#discussion_r331602301
 
 

 ##########
 File path: heron/metricsmgr/src/java/org/apache/heron/metricsmgr/sink/metricscache/MetricsCacheClient.java
 ##########
 @@ -93,12 +93,20 @@ private void addMetricsCacheClientTasksOnWakeUp() {
     Runnable task = new Runnable() {
       @Override
       public void run() {
-        while (!publishMetricsCommunicator.isEmpty()) {
-          TopologyMaster.PublishMetrics publishMetrics = publishMetricsCommunicator.poll();
+        TopologyMaster.PublishMetrics publishMetrics;
+        synchronized (publishMetricsCommunicator) {
+          publishMetrics = publishMetricsCommunicator.poll();
+        }
 
 Review comment:
   hmm, if we change the while loop condition, maybe we could reduce the code duplicate here? 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services