Github user unsleepy22 commented on a diff in the pull request:

    https://github.com/apache/storm/pull/1324#discussion_r61899624
  
    --- Diff: 
storm-core/src/jvm/org/apache/storm/metric/MetricsConsumerBolt.java ---
    @@ -47,17 +68,71 @@ public void prepare(Map stormConf, TopologyContext 
context, OutputCollector coll
             }
             _metricsConsumer.prepare(stormConf, _registrationArgument, 
context, collector);
             _collector = collector;
    +        _taskExecuteThread = new Thread(new MetricsHandlerRunnable());
    +        _taskExecuteThread.setDaemon(true);
    +        _taskExecuteThread.start();
         }
         
         @Override
         public void execute(Tuple input) {
    -        
_metricsConsumer.handleDataPoints((IMetricsConsumer.TaskInfo)input.getValue(0), 
(Collection)input.getValue(1));
    +        // remove older tasks if task queue exceeds the max size
    +        if (_taskQueue.size() > _maxRetainMetricTuples) {
    +            while (_taskQueue.size() - 1 > _maxRetainMetricTuples) {
    --- End diff --
    
    I guess we may run into a concurrent issue here, if while statement 
suffices, it poll one item, while at the same time, metrics consumer consumers 
one item, anyway, I don't think this matters too much so I'm ok to keep it as 
is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to