You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by et...@apache.org on 2020/04/16 13:39:32 UTC

[storm] branch master updated: [STORM-3622] use ThreadStatesGaugeSet instead of CachedThreadStatesGaugeSet to avoid race condition in CachedGauge

This is an automated email from the ASF dual-hosted git repository.

ethanli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b325e6  [STORM-3622] use ThreadStatesGaugeSet instead of CachedThreadStatesGaugeSet to avoid race condition in CachedGauge
     new 3890a03  Merge pull request #3248 from Ethanlm/STORM-3622
1b325e6 is described below

commit 1b325e6110414d9b425b4c74fd72e1e40bb98c9c
Author: Meng Li (Ethan) <et...@gmail.com>
AuthorDate: Tue Apr 14 16:35:37 2020 -0500

    [STORM-3622] use ThreadStatesGaugeSet instead of CachedThreadStatesGaugeSet to avoid race condition in CachedGauge
---
 storm-client/src/jvm/org/apache/storm/metric/SystemBolt.java | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/storm-client/src/jvm/org/apache/storm/metric/SystemBolt.java b/storm-client/src/jvm/org/apache/storm/metric/SystemBolt.java
index 9c68c89..70e4696 100644
--- a/storm-client/src/jvm/org/apache/storm/metric/SystemBolt.java
+++ b/storm-client/src/jvm/org/apache/storm/metric/SystemBolt.java
@@ -13,13 +13,12 @@
 package org.apache.storm.metric;
 
 import com.codahale.metrics.Gauge;
-import com.codahale.metrics.jvm.CachedThreadStatesGaugeSet;
 import com.codahale.metrics.jvm.GarbageCollectorMetricSet;
 import com.codahale.metrics.jvm.MemoryUsageGaugeSet;
+import com.codahale.metrics.jvm.ThreadStatesGaugeSet;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
 import org.apache.storm.Config;
 import org.apache.storm.metric.api.IMetric;
 import org.apache.storm.task.IBolt;
@@ -43,10 +42,8 @@ public class SystemBolt implements IBolt {
         }
         prepareWasCalled = true;
 
-        int bucketSize = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
-
         context.registerMetricSet("GC", new GarbageCollectorMetricSet());
-        context.registerMetricSet("threads", new CachedThreadStatesGaugeSet(bucketSize, TimeUnit.SECONDS));
+        context.registerMetricSet("threads", new ThreadStatesGaugeSet());
         context.registerMetricSet("memory", new MemoryUsageGaugeSet());
 
         final RuntimeMXBean jvmRt = ManagementFactory.getRuntimeMXBean();
@@ -87,6 +84,7 @@ public class SystemBolt implements IBolt {
             }
         });
 
+        int bucketSize = ObjectReader.getInt(topoConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
         registerMetrics(context, (Map<String, String>) topoConf.get(Config.WORKER_METRICS), bucketSize, topoConf);
         registerMetrics(context, (Map<String, String>) topoConf.get(Config.TOPOLOGY_WORKER_METRICS), bucketSize, topoConf);
     }