commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r1175096 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl: GenericKeyedObjectPool.java GenericObjectPool.java
Date Sat, 24 Sep 2011 02:32:13 GMT
Author: psteitz
Date: Sat Sep 24 02:32:13 2011
New Revision: 1175096

URL: http://svn.apache.org/viewvc?rev=1175096&view=rev
Log:
Don't do int division in mean update computation.

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1175096&r1=1175095&r2=1175096&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Sat Sep 24 02:32:13 2011
@@ -1732,8 +1732,8 @@ public class GenericKeyedObjectPool<K,T>
             Long time = iter.next();
             if (time != null) {
                 counter++;
-                result = result * ((counter - 1) / counter) +
-                        time.longValue()/counter;
+                result = result * ((counter - 1) / (double) counter) +
+                        time.longValue()/(double) counter;
             }
         }
         return (long) result;

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1175096&r1=1175095&r2=1175096&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
Sat Sep 24 02:32:13 2011
@@ -1292,8 +1292,8 @@ public class GenericObjectPool<T> extend
             Long time = iter.next();
             if (time != null) {
                 counter++;
-                result = result * ((counter - 1) / counter) +
-                        time.longValue()/counter;
+                result = result * ((counter - 1) / (double) counter) +
+                        time.longValue()/(double) counter;
             }
         }
         return (long) result;



Mime
View raw message