You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/08/16 08:21:27 UTC

[jmeter] branch master updated: Silence Sonar-Warnings

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0fe2b16  Silence Sonar-Warnings
0fe2b16 is described below

commit 0fe2b16320df017fb10376427e50293fba7cae6f
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Fri Aug 16 10:19:47 2019 +0200

    Silence Sonar-Warnings
    
    As WINDOW_MODE can now be changed for test modules, it is not constant anymore. So rename
    it with lower case. Add a dreprecation javadoc.
---
 .../org/apache/jmeter/visualizers/backend/SamplerMetric.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/visualizers/backend/SamplerMetric.java b/src/components/src/main/java/org/apache/jmeter/visualizers/backend/SamplerMetric.java
index 864835e..8a7086f 100644
--- a/src/components/src/main/java/org/apache/jmeter/visualizers/backend/SamplerMetric.java
+++ b/src/components/src/main/java/org/apache/jmeter/visualizers/backend/SamplerMetric.java
@@ -37,7 +37,7 @@ public class SamplerMetric {
     private static final int SLIDING_WINDOW_SIZE = JMeterUtils.getPropDefault("backend_metrics_window", 100);
     private static final int LARGE_SLIDING_WINDOW_SIZE = JMeterUtils.getPropDefault("backend_metrics_large_window", 5000);
 
-    private static volatile WindowMode WINDOW_MODE = WindowMode.get();
+    private static volatile WindowMode globalWindowMode = WindowMode.get();
 
     /**
      * Response times for OK samples
@@ -72,7 +72,7 @@ public class SamplerMetric {
      */
     public SamplerMetric() {
         // Limit to sliding window of SLIDING_WINDOW_SIZE values for FIXED mode
-        if (WINDOW_MODE == WindowMode.FIXED) {
+        if (globalWindowMode == WindowMode.FIXED) {
             for (DescriptiveStatistics stat : windowedStats) {
                 stat.setWindowSize(SLIDING_WINDOW_SIZE);
             }
@@ -82,11 +82,12 @@ public class SamplerMetric {
     /**
      * Set {@link WindowMode} to use for newly created metrics.
      * @param windowMode new visibility mode
+     * @deprecated only used for internal testing
      */
     @Deprecated
     @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
     public static void setDefaultWindowMode(WindowMode windowMode) {
-        WINDOW_MODE = windowMode;
+        globalWindowMode = windowMode;
     }
 
     /**
@@ -151,7 +152,7 @@ public class SamplerMetric {
      * Reset metric except for percentile related data
      */
     public synchronized void resetForTimeInterval() {
-        switch (WINDOW_MODE) {
+        switch (globalWindowMode) {
         case FIXED:
             // We don't clear responsesStats nor usersStats as it will slide as per my understanding of
             // http://commons.apache.org/proper/commons-math/userguide/stat.html