Author: jleroux
Date: Thu Aug 10 10:27:57 2017
New Revision: 1804656
URL:
http://svn.apache.org/viewvc?rev=1804656&view=revLog:
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/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java
Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java?rev=1804656&r1=1804655&r2=1804656&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/metrics/MetricsFactory.java Thu Aug 10 10:27:57 2017
@@ -156,7 +156,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> {
@@ -233,7 +233,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;