svn commit: r1804658 - in /ofbiz/branches: release13.07/framework/base/src/org/ofbiz/base/metrics/ release14.12/framework/base/src/org/ofbiz/base/metrics/ release15.12/framework/base/src/org/ofbiz/base/metrics/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1804658 - in /ofbiz/branches: release13.07/framework/base/src/org/ofbiz/base/metrics/ release14.12/framework/base/src/org/ofbiz/base/metrics/ release15.12/framework/base/src/org/ofbiz/base/metrics/

jleroux@apache.org
Author: jleroux
Date: Thu Aug 10 10:33:31 2017
New Revision: 1804658

URL: http://svn.apache.org/viewvc?rev=1804658&view=rev
Log:
Improved: [FB] Package org.apache.ofbiz.base.metrics
(OFBIZ-9567)

Changes a division with two long variables whose result was casted into a double
Now it performs a proper double division

Thanks: Dennis Balkir (and FB ;))

Modified:
    ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
    ofbiz/branches/release14.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
    ofbiz/branches/release15.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java

Modified: ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java?rev=1804658&r1=1804657&r2=1804658&view=diff
==============================================================================
--- ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java (original)
+++ ofbiz/branches/release13.07/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java Thu Aug 10 10:33:31 2017
@@ -134,7 +134,7 @@ public final class MetricsFactory {
      * Returns all <code>Metric</code> instances, sorted by name.
      */
     public static Collection<Metrics> getMetrics() {
-        return new TreeSet<Metrics>(METRICS_CACHE.values());
+        return new TreeSet<>(METRICS_CACHE.values());
     }
 
     private static final class MetricsImpl implements Metrics, Comparable<Metrics> {
@@ -217,7 +217,7 @@ public final class MetricsFactory {
                 if (totalEvents == 0) {
                     totalEvents = 1;
                 }
-                double rate = totalServiceTime / totalEvents;
+                double rate = totalServiceTime / (double) totalEvents;
                 serviceRate = (rate * smoothing) + (serviceRate * (1.0 - smoothing));
                 count = 0;
                 lastTime = curTime;

Modified: ofbiz/branches/release14.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java?rev=1804658&r1=1804657&r2=1804658&view=diff
==============================================================================
--- ofbiz/branches/release14.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java (original)
+++ ofbiz/branches/release14.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java Thu Aug 10 10:33:31 2017
@@ -134,7 +134,7 @@ public final class MetricsFactory {
      * Returns all <code>Metric</code> instances, sorted by name.
      */
     public static Collection<Metrics> getMetrics() {
-        return new TreeSet<Metrics>(METRICS_CACHE.values());
+        return new TreeSet<>(METRICS_CACHE.values());
     }
 
     private static final class MetricsImpl implements Metrics, Comparable<Metrics> {
@@ -217,7 +217,7 @@ public final class MetricsFactory {
                 if (totalEvents == 0) {
                     totalEvents = 1;
                 }
-                double rate = totalServiceTime / totalEvents;
+                double rate = totalServiceTime / (double) totalEvents;
                 serviceRate = (rate * smoothing) + (serviceRate * (1.0 - smoothing));
                 count = 0;
                 lastTime = curTime;

Modified: ofbiz/branches/release15.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java?rev=1804658&r1=1804657&r2=1804658&view=diff
==============================================================================
--- ofbiz/branches/release15.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java (original)
+++ ofbiz/branches/release15.12/framework/base/src/org/ofbiz/base/metrics/MetricsFactory.java Thu Aug 10 10:33:31 2017
@@ -134,7 +134,7 @@ public final class MetricsFactory {
      * Returns all <code>Metric</code> instances, sorted by name.
      */
     public static Collection<Metrics> getMetrics() {
-        return new TreeSet<Metrics>(METRICS_CACHE.values());
+        return new TreeSet<>(METRICS_CACHE.values());
     }
 
     private static final class MetricsImpl implements Metrics, Comparable<Metrics> {
@@ -217,7 +217,7 @@ public final class MetricsFactory {
                 if (totalEvents == 0) {
                     totalEvents = 1;
                 }
-                double rate = totalServiceTime / totalEvents;
+                double rate = totalServiceTime / (double) totalEvents;
                 serviceRate = (rate * smoothing) + (serviceRate * (1.0 - smoothing));
                 count = 0;
                 lastTime = curTime;