cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1486838 - in /cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters: ResponseTimeCounter.java ResponseTimeCounterMBean.java
Date Tue, 28 May 2013 09:49:11 GMT
Author: ffang
Date: Tue May 28 09:49:10 2013
New Revision: 1486838

URL: http://svn.apache.org/r1486838
Log:
[CXF-5016]ArithmeticException on ResponseTimeCounterMBean.getAvgResponseTime() after counter
reset() 

Modified:
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java?rev=1486838&r1=1486837&r2=1486838&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounter.java
Tue May 28 09:49:10 2013
@@ -102,6 +102,9 @@ public class ResponseTimeCounter impleme
     }
 
     public Number getAvgResponseTime() {        
+        if (invocations.get() == 0) {
+            return -1; //return -1 if invocation number is 0;
+        }
         return (int)(totalHandlingTime / invocations.get());
     }
     

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java?rev=1486838&r1=1486837&r2=1486838&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/counters/ResponseTimeCounterMBean.java
Tue May 28 09:49:10 2013
@@ -24,6 +24,12 @@ public interface ResponseTimeCounterMBea
     Number getNumLogicalRuntimeFaults();
     Number getNumRuntimeFaults();
     Number getNumUnCheckedApplicationFaults();
+    
+    /**
+     * Get the Average Response Time
+     * NOTE: if the invocation number is 0, this method
+     * will return -1
+     */
     Number getAvgResponseTime();
     Number getMaxResponseTime();
     Number getMinResponseTime();   



Mime
View raw message