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_r331709214
########## 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: 👍 ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services