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

rustyrazorblade pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c5eb532  Correct Visibility and Improve Safety of Methods in 
LatencyMetrics
c5eb532 is described below

commit c5eb532b63e80bb976d9dfdd4aa1c76f27f726e5
Author: Jeff Lai <j...@localytics.com>
AuthorDate: Sat Feb 29 10:06:11 2020 -0500

    Correct Visibility and Improve Safety of Methods in LatencyMetrics
    
    patch by jefftt; reviewed by Jordan West and Jon Haddad for CASSANDRA-15597
---
 CHANGES.txt                                               |  1 +
 src/java/org/apache/cassandra/metrics/LatencyMetrics.java | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 5dd25e4..5a9d3e1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0-alpha4
+ * Correct Visibility and Improve Safety of Methods in LatencyMetrics 
(CASSANDRA-15597)
  * Allow cqlsh to run with Python2.7/Python3.6+ 
(CASSANDRA-15659,CASSANDRA-15573)
  * Improve logging around incremental repair (CASSANDRA-15599)
  * Do not check cdc_raw_directory filesystem space if CDC disabled 
(CASSANDRA-15688)
diff --git a/src/java/org/apache/cassandra/metrics/LatencyMetrics.java 
b/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
index 7d5d288..ab4c9a5 100644
--- a/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/LatencyMetrics.java
@@ -37,7 +37,7 @@ import static 
org.apache.cassandra.metrics.CassandraMetricsRegistry.Metrics;
 public class LatencyMetrics
 {
     /** Latency */
-    public final Timer latency;
+    public final LatencyMetricsTimer latency;
     /** Total latency in micro sec */
     public final Counter totalLatency;
 
@@ -89,7 +89,7 @@ public class LatencyMetrics
         this.aliasFactory = aliasFactory;
         this.namePrefix = namePrefix;
 
-        Timer timer = new LatencyMetrics.LatencyMetricsTimer(new 
DecayingEstimatedHistogramReservoir());
+        LatencyMetricsTimer timer = new LatencyMetrics.LatencyMetricsTimer(new 
DecayingEstimatedHistogramReservoir());
         Counter counter = new LatencyMetricsCounter();
 
         if (aliasFactory == null)
@@ -122,12 +122,12 @@ public class LatencyMetrics
         }
     }
 
-    public void addChildren(LatencyMetrics latencyMetric) 
+    private void addChildren(LatencyMetrics latencyMetric)
     {
         this.children.add(latencyMetric);
     }
 
-    public synchronized void removeChildren(LatencyMetrics toRelease)
+    private synchronized void removeChildren(LatencyMetrics toRelease)
     {
         /*
         Merge details of removed children metrics and add them to our local 
copy to prevent metrics from going
@@ -135,7 +135,7 @@ public class LatencyMetrics
         Will not protect against simultaneous updates, but since these methods 
are used by linked parent instances only,
         they should not receive any updates.
          */
-        ((LatencyMetricsTimer) this.latency).releasedLatencyCount += 
toRelease.latency.getCount();
+        this.latency.releasedLatencyCount += toRelease.latency.getCount();
 
         
DecayingEstimatedHistogramReservoir.EstimatedHistogramReservoirSnapshot 
childSnapshot = 
(DecayingEstimatedHistogramReservoir.EstimatedHistogramReservoirSnapshot) 
toRelease.latency.getSnapshot();
         
DecayingEstimatedHistogramReservoir.EstimatedHistogramReservoirSnapshot 
snapshot = 
(DecayingEstimatedHistogramReservoir.EstimatedHistogramReservoirSnapshot) 
this.latency.getSnapshot();
@@ -176,7 +176,7 @@ public class LatencyMetrics
         }
     }
 
-    class LatencyMetricsTimer extends Timer 
+    public class LatencyMetricsTimer extends Timer
     {
 
         long releasedLatencyCount = 0;


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

Reply via email to