commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1242442 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Date Thu, 09 Feb 2012 18:26:41 GMT
Author: markt
Date: Thu Feb  9 18:26:41 2012
New Revision: 1242442

URL: http://svn.apache.org/viewvc?rev=1242442&view=rev
Log:
Fix POOL-207
Remove unnecessary null check and simplify code in a few places.

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.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=1242442&r1=1242441&r2=1242442&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
Thu Feb  9 18:26:41 2012
@@ -1041,13 +1041,9 @@ public class GenericKeyedObjectPool<K,T>
       */
      public void clear(K key) {
          
-         register(key);
+         ObjectDeque<T> objectDeque = register(key);
          
          try {
-             ObjectDeque<T> objectDeque = poolMap.get(key);
-             if (objectDeque == null) {
-                 return;
-             }
              LinkedBlockingDeque<PooledObject<T>> idleObjects =
                      objectDeque.getIdleObjects();
              
@@ -1496,10 +1492,9 @@ public class GenericKeyedObjectPool<K,T>
     private boolean destroy(K key, PooledObject<T> toDestroy, boolean always)
             throws Exception {
         
-        register(key);
+        ObjectDeque<T> objectDeque = register(key);
 
         try {
-            ObjectDeque<T> objectDeque = poolMap.get(key);
             boolean isIdle = objectDeque.getIdleObjects().remove(toDestroy);
             
             if (isIdle || always) {



Mime
View raw message