commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1102216 - in /commons/proper/pool/trunk/src: changes/ java/org/apache/commons/pool2/impl/ test/org/apache/commons/pool2/impl/
Date Thu, 12 May 2011 09:44:24 GMT
Author: markt
Date: Thu May 12 09:44:23 2011
New Revision: 1102216

URL: http://svn.apache.org/viewvc?rev=1102216&view=rev
Log:
Switch to enum for WhenExhuastedAction

Added:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java
      - copied, changed from r1102188, commons/proper/pool/branches/POOL_FUTURE/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java
Modified:
    commons/proper/pool/trunk/src/changes/changes.xml
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolFactory.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolFactory.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java
    commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java

Modified: commons/proper/pool/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/changes/changes.xml?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/changes/changes.xml (original)
+++ commons/proper/pool/trunk/src/changes/changes.xml Thu May 12 09:44:23 2011
@@ -40,6 +40,10 @@
       Code clean-up. Add missing @Override annotations, remove unused code and
       remove deprecated code.
     </action>
+    <action dev="markt" type="update">
+      Introduce an Enum (WhenExhaustedAction) to control pool behaviour when no
+      more objects are available to allocate.
+    </action>
   </release>
   <release version="1.5.6" date="2011-04-03" description="This is a patch release, including bugfixes only.">
     <action dev="markt" type="fix" issue="POOL-179" due-to="Axel Grossmann">

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=1102216&r1=1102215&r2=1102216&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 May 12 09:44:23 2011
@@ -208,42 +208,6 @@ public class GenericKeyedObjectPool<K,V>
     //--- public constants -------------------------------------------
 
     /**
-     * A "when exhausted action" type indicating that when the pool is
-     * exhausted (i.e., the maximum number of active objects has
-     * been reached), the {@link #borrowObject}
-     * method should fail, throwing a {@link NoSuchElementException}.
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_FAIL   = 0;
-
-    /**
-     * A "when exhausted action" type indicating that when the pool
-     * is exhausted (i.e., the maximum number
-     * of active objects has been reached), the {@link #borrowObject}
-     * method should block until a new object is available, or the
-     * {@link #getMaxWait maximum wait time} has been reached.
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setMaxWait
-     * @see #getMaxWait
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_BLOCK  = 1;
-
-    /**
-     * A "when exhausted action" type indicating that when the pool is
-     * exhausted (i.e., the maximum number
-     * of active objects has been reached), the {@link #borrowObject}
-     * method should simply create a new object anyway.
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_GROW   = 2;
-
-    /**
      * The default cap on the number of idle instances (per key) in the pool.
      * @see #getMaxIdle
      * @see #setMaxIdle
@@ -268,12 +232,10 @@ public class GenericKeyedObjectPool<K,V>
 
     /**
      * The default "when exhausted action" for the pool.
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
      * @see #setWhenExhaustedAction
      */
-    public static final byte DEFAULT_WHEN_EXHAUSTED_ACTION = WHEN_EXHAUSTED_BLOCK;
+    public static final WhenExhaustedAction DEFAULT_WHEN_EXHAUSTED_ACTION =
+        WhenExhaustedAction.BLOCK;
 
     /**
      * The default maximum amount of time (in milliseconds) the
@@ -409,7 +371,7 @@ public class GenericKeyedObjectPool<K,V>
      * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted and
      *  <code>whenExhaustedAction</code> is {@link #WHEN_EXHAUSTED_BLOCK} (otherwise ignored) (see {@link #setMaxWait})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait) {
         this(factory, maxActive, whenExhaustedAction, maxWait, DEFAULT_MAX_IDLE, DEFAULT_TEST_ON_BORROW,
                 DEFAULT_TEST_ON_RETURN, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
@@ -429,7 +391,7 @@ public class GenericKeyedObjectPool<K,V>
      * @param testOnReturn whether or not to validate objects after they are returned to the {@link #returnObject}
      * method (see {@link #setTestOnReturn})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, boolean testOnBorrow, boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait, DEFAULT_MAX_IDLE,testOnBorrow,testOnReturn,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
@@ -447,7 +409,7 @@ public class GenericKeyedObjectPool<K,V>
      * <code>whenExhaustedAction</code> is {@link #WHEN_EXHAUSTED_BLOCK} (otherwise ignored) (see {@link #setMaxWait})
      * @param maxIdle the maximum number of idle objects in my pool (see {@link #setMaxIdle})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
@@ -469,7 +431,7 @@ public class GenericKeyedObjectPool<K,V>
      * @param testOnReturn whether or not to validate objects after they are returned to the {@link #returnObject}
      * method (see {@link #setTestOnReturn})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, testOnBorrow, testOnReturn,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
@@ -500,7 +462,7 @@ public class GenericKeyedObjectPool<K,V>
      * @param testWhileIdle whether or not to validate objects in the idle object eviction thread, if any
      * (see {@link #setTestWhileIdle})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis,
             int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,
@@ -532,7 +494,7 @@ public class GenericKeyedObjectPool<K,V>
      * @param testWhileIdle whether or not to validate objects in the idle object eviction thread, if any
      * (see {@link #setTestWhileIdle})
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
             boolean testWhileIdle) {
@@ -567,7 +529,7 @@ public class GenericKeyedObjectPool<K,V>
      * (see {@link #setTestWhileIdle})
      * @since Pool 1.3
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
             boolean testWhileIdle) {
@@ -603,22 +565,14 @@ public class GenericKeyedObjectPool<K,V>
      * @param lifo whether or not the pools behave as LIFO (last in first out) queues (see {@link #setLifo})
      * @since Pool 1.4
      */
-    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction,
+    public GenericKeyedObjectPool(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction,
             long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
             boolean testWhileIdle, boolean lifo) {
         _factory = factory;
         _maxActive = maxActive;
         _lifo = lifo;
-        switch (whenExhaustedAction) {
-            case WHEN_EXHAUSTED_BLOCK:
-            case WHEN_EXHAUSTED_FAIL:
-            case WHEN_EXHAUSTED_GROW:
-                _whenExhaustedAction = whenExhaustedAction;
-                break;
-            default:
-                throw new IllegalArgumentException("whenExhaustedAction " + whenExhaustedAction + " not recognized.");
-        }
+        _whenExhaustedAction = whenExhaustedAction;
         _maxWait = maxWait;
         _maxIdle = maxIdle;
         _maxTotal = maxTotal;
@@ -700,11 +654,10 @@ public class GenericKeyedObjectPool<K,V>
      * is invoked when the pool is exhausted (the maximum number
      * of "active" objects has been reached).
      *
-     * @return one of {@link #WHEN_EXHAUSTED_BLOCK},
-     * {@link #WHEN_EXHAUSTED_FAIL} or {@link #WHEN_EXHAUSTED_GROW}
+     * @return the action to take when exhausted
      * @see #setWhenExhaustedAction
      */
-    public synchronized byte getWhenExhaustedAction() {
+    public synchronized WhenExhaustedAction getWhenExhaustedAction() {
         return _whenExhaustedAction;
     }
 
@@ -713,22 +666,12 @@ public class GenericKeyedObjectPool<K,V>
      * is invoked when the pool is exhausted (the maximum number
      * of "active" objects has been reached).
      *
-     * @param whenExhaustedAction the action code, which must be one of
-     *        {@link #WHEN_EXHAUSTED_BLOCK}, {@link #WHEN_EXHAUSTED_FAIL},
-     *        or {@link #WHEN_EXHAUSTED_GROW}
+     * @param the action to take when exhausted
      * @see #getWhenExhaustedAction
      */
-    public void setWhenExhaustedAction(byte whenExhaustedAction) {
+    public void setWhenExhaustedAction(WhenExhaustedAction whenExhaustedAction) {
         synchronized(this) {
-            switch(whenExhaustedAction) {
-                case WHEN_EXHAUSTED_BLOCK:
-                case WHEN_EXHAUSTED_FAIL:
-                case WHEN_EXHAUSTED_GROW:
-                    _whenExhaustedAction = whenExhaustedAction;
-                    break;
-                default:
-                    throw new IllegalArgumentException("whenExhaustedAction " + whenExhaustedAction + " not recognized.");
-            }
+            _whenExhaustedAction = whenExhaustedAction;
         }
         allocate();
     }
@@ -1091,7 +1034,7 @@ public class GenericKeyedObjectPool<K,V>
     public V borrowObject(K key) throws Exception {
         long starttime = System.currentTimeMillis();
         Latch latch = new Latch(key);
-        byte whenExhaustedAction;
+        WhenExhaustedAction whenExhaustedAction;
         long maxWait;
         synchronized (this) {
             // Get local copy of current config. Can't sync when used later as
@@ -1119,7 +1062,7 @@ public class GenericKeyedObjectPool<K,V>
                 } else {
                     // the pool is exhausted
                     switch(whenExhaustedAction) {
-                        case WHEN_EXHAUSTED_GROW:
+                        case GROW:
                             // allow new object to be created
                             synchronized (this) {
                                 // Make sure another thread didn't allocate us an object
@@ -1130,7 +1073,7 @@ public class GenericKeyedObjectPool<K,V>
                                 }
                             }
                         break;
-                        case WHEN_EXHAUSTED_FAIL:
+                        case FAIL:
                             synchronized (this) {
                                 // Make sure allocate hasn't already assigned an object
                                 // in a different thread or permitted a new object to be created
@@ -1140,7 +1083,7 @@ public class GenericKeyedObjectPool<K,V>
                                 _allocationQueue.remove(latch);
                             }
                             throw new NoSuchElementException("Pool exhausted");
-                        case WHEN_EXHAUSTED_BLOCK:
+                        case BLOCK:
                             try {
                                 synchronized (latch) {
                                     // Before we wait, make sure another thread didn't allocate us an object
@@ -2386,7 +2329,7 @@ public class GenericKeyedObjectPool<K,V>
         /**
          * @see GenericKeyedObjectPool#setWhenExhaustedAction
          */
-        public byte whenExhaustedAction = GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
+        public WhenExhaustedAction whenExhaustedAction = GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
         /**
          * @see GenericKeyedObjectPool#setTestOnBorrow
          */
@@ -2568,14 +2511,11 @@ public class GenericKeyedObjectPool<K,V>
      * is invoked when the pool is exhausted (the maximum number
      * of "active" objects has been reached).
      *
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
      * @see #DEFAULT_WHEN_EXHAUSTED_ACTION
      * @see #setWhenExhaustedAction
      * @see #getWhenExhaustedAction
      */
-    private byte _whenExhaustedAction = DEFAULT_WHEN_EXHAUSTED_ACTION;
+    private WhenExhaustedAction _whenExhaustedAction = DEFAULT_WHEN_EXHAUSTED_ACTION;
 
     /**
      * When <code>true</code>, objects will be

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolFactory.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPoolFactory.java Thu May 12 09:44:23 2011
@@ -78,7 +78,7 @@ public class GenericKeyedObjectPoolFacto
      * @param maxWait the maximum amount of time to wait for an idle object when the pool is exhausted.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait) {
         this(factory,maxActive,whenExhaustedAction,maxWait,GenericKeyedObjectPool.DEFAULT_MAX_IDLE, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE);
     }
 
@@ -93,7 +93,7 @@ public class GenericKeyedObjectPoolFacto
      * @param testOnReturn whether to validate objects after they are returned to returnObject.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, boolean, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, boolean testOnBorrow, boolean testOnReturn) {
         this(factory,maxActive,whenExhaustedAction,maxWait,GenericKeyedObjectPool.DEFAULT_MAX_IDLE, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,testOnBorrow,testOnReturn,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE);
     }
 
@@ -107,7 +107,7 @@ public class GenericKeyedObjectPoolFacto
      * @param maxIdle the maximum number of idle objects in the pools.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle) {
         this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE);
     }
 
@@ -121,7 +121,7 @@ public class GenericKeyedObjectPoolFacto
      * @param maxIdle the maximum number of idle objects in the pools.
      * @param maxTotal the maximum number of objects that can exists at one time.
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, int maxTotal) {
         this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, maxTotal, GenericKeyedObjectPool.DEFAULT_TEST_ON_BORROW,GenericKeyedObjectPool.DEFAULT_TEST_ON_RETURN,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE);
     }
 
@@ -137,7 +137,7 @@ public class GenericKeyedObjectPoolFacto
      * @param testOnReturn whether to validate objects after they are returned to returnObject.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn) {
         this(factory,maxActive,whenExhaustedAction,maxWait,maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL,testOnBorrow,testOnReturn,GenericKeyedObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,GenericKeyedObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,GenericKeyedObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,GenericKeyedObjectPool.DEFAULT_TEST_WHILE_IDLE);
     }
 
@@ -157,7 +157,7 @@ public class GenericKeyedObjectPoolFacto
      * @param testWhileIdle whether to validate objects in the idle object eviction thread.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, boolean, boolean, long, int, long, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL, testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle);
     }
 
@@ -178,7 +178,7 @@ public class GenericKeyedObjectPoolFacto
      * @param testWhileIdle whether to validate objects in the idle object eviction thread.
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, boolean, boolean, long, int, long, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, maxTotal, GenericKeyedObjectPool.DEFAULT_MIN_IDLE , testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle);
     }
 
@@ -201,7 +201,7 @@ public class GenericKeyedObjectPoolFacto
      * @since Pool 1.3
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle, maxTotal, minIdle, testOnBorrow, testOnReturn, timeBetweenEvictionRunsMillis, numTestsPerEvictionRun, minEvictableIdleTimeMillis, testWhileIdle, GenericKeyedObjectPool.DEFAULT_LIFO);
     }
 
@@ -225,7 +225,7 @@ public class GenericKeyedObjectPoolFacto
      * @since Pool 1.4
      * @see GenericKeyedObjectPool#GenericKeyedObjectPool(KeyedPoolableObjectFactory, int, byte, long, int, int, int, boolean, boolean, long, int, long, boolean, boolean)
      */
-    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, boolean lifo) {
+    public GenericKeyedObjectPoolFactory(KeyedPoolableObjectFactory<K,V> factory, int maxActive, WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle, int maxTotal, int minIdle, boolean testOnBorrow, boolean testOnReturn, long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun, long minEvictableIdleTimeMillis, boolean testWhileIdle, boolean lifo) {
         _maxIdle = maxIdle;
         _maxActive = maxActive;
         _maxTotal = maxTotal;
@@ -296,7 +296,7 @@ public class GenericKeyedObjectPoolFacto
      * @return the {@link GenericKeyedObjectPool#getWhenExhaustedAction() whenExhaustedAction} setting for pools created by this factory.
      * @since 1.5.5
      */
-    public byte getWhenExhaustedAction() {
+    public WhenExhaustedAction getWhenExhaustedAction() {
         return _whenExhaustedAction;
     }
 
@@ -397,7 +397,7 @@ public class GenericKeyedObjectPoolFacto
     /**
      * The {@link GenericKeyedObjectPool#getWhenExhaustedAction() whenExhaustedAction} setting for pools created by this factory.
      */
-    private byte _whenExhaustedAction = GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
+    private WhenExhaustedAction _whenExhaustedAction = GenericKeyedObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
     
     /**
      * The {@link GenericKeyedObjectPool#getTestOnBorrow() testOnBorrow} setting for pools created by this factory.

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=1102216&r1=1102215&r2=1102216&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 Thu May 12 09:44:23 2011
@@ -174,43 +174,6 @@ public class GenericObjectPool<T> extend
     // --- public constants -------------------------------------------
 
     /**
-     * A "when exhausted action" type indicating that when the pool is exhausted
-     * (i.e., the maximum number of active objects has been reached), the
-     * {@link #borrowObject} method should fail, throwing a
-     * {@link NoSuchElementException}.
-     * 
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_FAIL = 0;
-
-    /**
-     * A "when exhausted action" type indicating that when the pool is exhausted
-     * (i.e., the maximum number of active objects has been reached), the
-     * {@link #borrowObject} method should block until a new object is
-     * available, or the {@link #getMaxWait maximum wait time} has been reached.
-     * 
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setMaxWait
-     * @see #getMaxWait
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_BLOCK = 1;
-
-    /**
-     * A "when exhausted action" type indicating that when the pool is exhausted
-     * (i.e., the maximum number of active objects has been reached), the
-     * {@link #borrowObject} method should simply create a new object anyway.
-     * 
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
-     * @see #setWhenExhaustedAction
-     */
-    public static final byte WHEN_EXHAUSTED_GROW = 2;
-
-    /**
      * The default cap on the number of "sleeping" instances in the pool.
      * 
      * @see #getMaxIdle
@@ -237,12 +200,10 @@ public class GenericObjectPool<T> extend
     /**
      * The default "when exhausted action" for the pool.
      * 
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
      * @see #setWhenExhaustedAction
      */
-    public static final byte DEFAULT_WHEN_EXHAUSTED_ACTION = WHEN_EXHAUSTED_BLOCK;
+    public static final WhenExhaustedAction DEFAULT_WHEN_EXHAUSTED_ACTION =
+        WhenExhaustedAction.BLOCK;
 
     /**
      * The default LIFO status. True means that borrowObject returns the most
@@ -318,7 +279,8 @@ public class GenericObjectPool<T> extend
      * @see #getMinEvictableIdleTimeMillis
      * @see #setMinEvictableIdleTimeMillis
      */
-    public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS = 1000L * 60L * 30L;
+    public static final long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS =
+            1000L * 60L * 30L;
 
     /**
      * The default value for {@link #getSoftMinEvictableIdleTimeMillis}.
@@ -339,7 +301,8 @@ public class GenericObjectPool<T> extend
                 DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -355,7 +318,8 @@ public class GenericObjectPool<T> extend
                 DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -395,7 +359,8 @@ public class GenericObjectPool<T> extend
                 DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -417,13 +382,14 @@ public class GenericObjectPool<T> extend
      *            {@link #getMaxWait})
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait) {
+            WhenExhaustedAction whenExhaustedAction, long maxWait) {
         this(factory, maxActive, whenExhaustedAction, maxWait,
                 DEFAULT_MAX_IDLE, DEFAULT_MIN_IDLE, DEFAULT_TEST_ON_BORROW,
                 DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -453,13 +419,14 @@ public class GenericObjectPool<T> extend
      *            )
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, boolean testOnBorrow,
-            boolean testOnReturn) {
+            WhenExhaustedAction whenExhaustedAction, long maxWait,
+            boolean testOnBorrow, boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait,
                 DEFAULT_MAX_IDLE, DEFAULT_MIN_IDLE, testOnBorrow, testOnReturn,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -484,13 +451,15 @@ public class GenericObjectPool<T> extend
      *            {@link #getMaxIdle})
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle) {
+            WhenExhaustedAction whenExhaustedAction, long maxWait,
+            int maxIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 DEFAULT_MIN_IDLE, DEFAULT_TEST_ON_BORROW,
                 DEFAULT_TEST_ON_RETURN,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -523,13 +492,14 @@ public class GenericObjectPool<T> extend
      *            )
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle,
+            WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle,
             boolean testOnBorrow, boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 DEFAULT_MIN_IDLE, testOnBorrow, testOnReturn,
                 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
                 DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_TEST_WHILE_IDLE);
+                DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
+                DEFAULT_TEST_WHILE_IDLE);
     }
 
     /**
@@ -577,7 +547,7 @@ public class GenericObjectPool<T> extend
      *            thread, if any (see {@link #setTestWhileIdle})
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle,
+            WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle,
             boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
             long minEvictableIdleTimeMillis, boolean testWhileIdle) {
@@ -635,8 +605,8 @@ public class GenericObjectPool<T> extend
      *            thread, if any (see {@link #setTestWhileIdle})
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle,
-            boolean testOnBorrow, boolean testOnReturn,
+            WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle,
+            int minIdle, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
             long minEvictableIdleTimeMillis, boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
@@ -700,8 +670,8 @@ public class GenericObjectPool<T> extend
      * @since Pool 1.3
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle,
-            boolean testOnBorrow, boolean testOnReturn,
+            WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle,
+            int minIdle, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
             long minEvictableIdleTimeMillis, boolean testWhileIdle,
             long softMinEvictableIdleTimeMillis) {
@@ -769,24 +739,15 @@ public class GenericObjectPool<T> extend
      * @since Pool 1.4
      */
     public GenericObjectPool(PoolableObjectFactory<T> factory, int maxActive,
-            byte whenExhaustedAction, long maxWait, int maxIdle, int minIdle,
-            boolean testOnBorrow, boolean testOnReturn,
+            WhenExhaustedAction whenExhaustedAction, long maxWait, int maxIdle,
+            int minIdle, boolean testOnBorrow, boolean testOnReturn,
             long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
             long minEvictableIdleTimeMillis, boolean testWhileIdle,
             long softMinEvictableIdleTimeMillis, boolean lifo) {
         _factory = factory;
         _maxActive = maxActive;
         _lifo = lifo;
-        switch (whenExhaustedAction) {
-        case WHEN_EXHAUSTED_BLOCK:
-        case WHEN_EXHAUSTED_FAIL:
-        case WHEN_EXHAUSTED_GROW:
-            _whenExhaustedAction = whenExhaustedAction;
-            break;
-        default:
-            throw new IllegalArgumentException("whenExhaustedAction " +
-                    whenExhaustedAction + " not recognized.");
-        }
+        _whenExhaustedAction = whenExhaustedAction;
         _maxWait = maxWait;
         _maxIdle = maxIdle;
         _minIdle = minIdle;
@@ -842,11 +803,10 @@ public class GenericObjectPool<T> extend
      * invoked when the pool is exhausted (the maximum number of "active"
      * objects has been reached).
      * 
-     * @return one of {@link #WHEN_EXHAUSTED_BLOCK},
-     *         {@link #WHEN_EXHAUSTED_FAIL} or {@link #WHEN_EXHAUSTED_GROW}
+     * @return the action to take when the pool is exhuasted
      * @see #setWhenExhaustedAction
      */
-    public byte getWhenExhaustedAction() {
+    public WhenExhaustedAction getWhenExhaustedAction() {
         return _whenExhaustedAction;
     }
 
@@ -855,23 +815,12 @@ public class GenericObjectPool<T> extend
      * when the pool is exhausted (the maximum number of "active" objects has
      * been reached).
      * 
-     * @param whenExhaustedAction
-     *            the action code, which must be one of
-     *            {@link #WHEN_EXHAUSTED_BLOCK}, {@link #WHEN_EXHAUSTED_FAIL},
-     *            or {@link #WHEN_EXHAUSTED_GROW}
+     * @param whenExhaustedAction   action to take when the pool is exhausted
      * @see #getWhenExhaustedAction
      */
-    public void setWhenExhaustedAction(byte whenExhaustedAction) {
-        switch (whenExhaustedAction) {
-        case WHEN_EXHAUSTED_BLOCK:
-        case WHEN_EXHAUSTED_FAIL:
-        case WHEN_EXHAUSTED_GROW:
-            _whenExhaustedAction = whenExhaustedAction;
-            break;
-        default:
-            throw new IllegalArgumentException("whenExhaustedAction " +
-                    whenExhaustedAction + " not recognized.");
-        }
+    public void setWhenExhaustedAction(
+            WhenExhaustedAction whenExhaustedAction) {
+        _whenExhaustedAction = whenExhaustedAction;
     }
 
     /**
@@ -1274,7 +1223,7 @@ public class GenericObjectPool<T> extend
 
         assertOpen();
 
-        byte whenExhaustedAction;
+        WhenExhaustedAction whenExhaustedAction;
         long maxWait;
         PooledObject<T> p = null;
 
@@ -1287,7 +1236,7 @@ public class GenericObjectPool<T> extend
 
         while (p == null) {
             create = false;
-            if (whenExhaustedAction == WHEN_EXHAUSTED_FAIL) {
+            if (whenExhaustedAction == WhenExhaustedAction.FAIL) {
                 p = _idleObjects.pollFirst();
                 if (p == null) {
                     create = true;
@@ -1299,7 +1248,7 @@ public class GenericObjectPool<T> extend
                 if (!p.allocate()) {
                     p = null;
                 }
-            } else if (whenExhaustedAction == WHEN_EXHAUSTED_BLOCK) {
+            } else if (whenExhaustedAction == WhenExhaustedAction.BLOCK) {
                 p = _idleObjects.pollFirst();
                 if (p == null) {
                     create = true;
@@ -1320,7 +1269,7 @@ public class GenericObjectPool<T> extend
                 if (!p.allocate()) {
                     p = null;
                 }
-            } else if (whenExhaustedAction == WHEN_EXHAUSTED_GROW) {
+            } else if (whenExhaustedAction == WhenExhaustedAction.GROW) {
                 p = _idleObjects.pollFirst();
                 if (p == null) {
                     create = true;
@@ -1875,7 +1824,7 @@ public class GenericObjectPool<T> extend
         /**
          * @see GenericObjectPool#setWhenExhaustedAction
          */
-        public byte whenExhaustedAction =
+        public WhenExhaustedAction whenExhaustedAction =
             GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
         /**
          * @see GenericObjectPool#setTestOnBorrow
@@ -1963,14 +1912,12 @@ public class GenericObjectPool<T> extend
      * the pool is exhausted (the maximum number of "active" objects has been
      * reached).
      * 
-     * @see #WHEN_EXHAUSTED_BLOCK
-     * @see #WHEN_EXHAUSTED_FAIL
-     * @see #WHEN_EXHAUSTED_GROW
      * @see #DEFAULT_WHEN_EXHAUSTED_ACTION
      * @see #setWhenExhaustedAction
      * @see #getWhenExhaustedAction
      */
-    private volatile byte _whenExhaustedAction = DEFAULT_WHEN_EXHAUSTED_ACTION;
+    private volatile WhenExhaustedAction _whenExhaustedAction =
+        DEFAULT_WHEN_EXHAUSTED_ACTION;
 
     /**
      * When <tt>true</tt>, objects will be

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolFactory.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPoolFactory.java Thu May 12 09:44:23 2011
@@ -121,7 +121,8 @@ public class GenericObjectPoolFactory<T>
      *      byte, long)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait) {
         this(factory, maxActive, whenExhaustedAction, maxWait,
                 GenericObjectPool.DEFAULT_MAX_IDLE,
                 GenericObjectPool.DEFAULT_MIN_IDLE,
@@ -156,8 +157,8 @@ public class GenericObjectPoolFactory<T>
      *      byte, long, boolean, boolean)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait,
-            boolean testOnBorrow, boolean testOnReturn) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, boolean testOnBorrow, boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait,
                 GenericObjectPool.DEFAULT_MAX_IDLE,
                 GenericObjectPool.DEFAULT_MIN_IDLE, testOnBorrow, testOnReturn,
@@ -186,7 +187,8 @@ public class GenericObjectPoolFactory<T>
      *      byte, long, int)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 GenericObjectPool.DEFAULT_MIN_IDLE,
                 GenericObjectPool.DEFAULT_TEST_ON_BORROW,
@@ -222,8 +224,9 @@ public class GenericObjectPoolFactory<T>
      *      byte, long, int, boolean, boolean)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle,
-            boolean testOnBorrow, boolean testOnReturn) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle, boolean testOnBorrow,
+            boolean testOnReturn) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 GenericObjectPool.DEFAULT_MIN_IDLE, testOnBorrow, testOnReturn,
                 GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
@@ -269,10 +272,11 @@ public class GenericObjectPoolFactory<T>
      *      byte, long, int, boolean, boolean, long, int, long, boolean)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle,
-            boolean testOnBorrow, boolean testOnReturn,
-            long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
-            long minEvictableIdleTimeMillis, boolean testWhileIdle) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle, boolean testOnBorrow,
+            boolean testOnReturn, long timeBetweenEvictionRunsMillis,
+            int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
+            boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 GenericObjectPool.DEFAULT_MIN_IDLE, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
@@ -319,10 +323,11 @@ public class GenericObjectPoolFactory<T>
      *      byte, long, int, int, boolean, boolean, long, int, long, boolean)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle,
-            int minIdle, boolean testOnBorrow, boolean testOnReturn,
-            long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
-            long minEvictableIdleTimeMillis, boolean testWhileIdle) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle, int minIdle, boolean testOnBorrow,
+            boolean testOnReturn, long timeBetweenEvictionRunsMillis,
+            int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
+            boolean testWhileIdle) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 minIdle, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
@@ -376,11 +381,11 @@ public class GenericObjectPoolFactory<T>
      *      long)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle,
-            int minIdle, boolean testOnBorrow, boolean testOnReturn,
-            long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
-            long minEvictableIdleTimeMillis, boolean testWhileIdle,
-            long softMinEvictableIdleTimeMillis) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle, int minIdle, boolean testOnBorrow,
+            boolean testOnReturn, long timeBetweenEvictionRunsMillis,
+            int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
+            boolean testWhileIdle, long softMinEvictableIdleTimeMillis) {
         this(factory, maxActive, whenExhaustedAction, maxWait, maxIdle,
                 minIdle, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
@@ -437,11 +442,12 @@ public class GenericObjectPoolFactory<T>
      *      long, boolean)
      */
     public GenericObjectPoolFactory(PoolableObjectFactory<T> factory,
-            int maxActive, byte whenExhaustedAction, long maxWait, int maxIdle,
-            int minIdle, boolean testOnBorrow, boolean testOnReturn,
-            long timeBetweenEvictionRunsMillis, int numTestsPerEvictionRun,
-            long minEvictableIdleTimeMillis, boolean testWhileIdle,
-            long softMinEvictableIdleTimeMillis, boolean lifo) {
+            int maxActive, WhenExhaustedAction whenExhaustedAction,
+            long maxWait, int maxIdle, int minIdle, boolean testOnBorrow,
+            boolean testOnReturn, long timeBetweenEvictionRunsMillis,
+            int numTestsPerEvictionRun, long minEvictableIdleTimeMillis,
+            boolean testWhileIdle, long softMinEvictableIdleTimeMillis,
+            boolean lifo) {
         _maxIdle = maxIdle;
         _minIdle = minIdle;
         _maxActive = maxActive;
@@ -510,7 +516,7 @@ public class GenericObjectPoolFactory<T>
      *         whenExhaustedAction} setting for pools created by this factory.
      * @since 1.5.5
      */
-    public byte getWhenExhaustedAction() {
+    public WhenExhaustedAction getWhenExhaustedAction() {
         return _whenExhaustedAction;
     }
 
@@ -626,7 +632,7 @@ public class GenericObjectPoolFactory<T>
      * The {@link GenericObjectPool#getWhenExhaustedAction()
      * whenExhaustedAction} setting for pools created by this factory.
      */
-    private byte _whenExhaustedAction =
+    private WhenExhaustedAction _whenExhaustedAction =
         GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION;
 
     /**

Copied: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java (from r1102188, commons/proper/pool/branches/POOL_FUTURE/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java)
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java?p2=commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java&p1=commons/proper/pool/branches/POOL_FUTURE/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java&r1=1102188&r2=1102216&rev=1102216&view=diff
==============================================================================
--- commons/proper/pool/branches/POOL_FUTURE/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/WhenExhaustedAction.java Thu May 12 09:44:23 2011
@@ -19,11 +19,9 @@ package org.apache.commons.pool2.impl;
 import java.util.NoSuchElementException;
 
 /**
- * A "when exhausted action" type indicating that when the pool is
- * exhausted (i.e., the maximum number of active objects has
- * been reached).
+ * A "when exhausted action" type indicating that when the pool is exhausted
+ * (i.e., the maximum number of active objects has been reached).
  *
- * @version $Revision$ $Date$
  * @since Pool 2.0
  */
 public enum WhenExhaustedAction {
@@ -36,8 +34,9 @@ public enum WhenExhaustedAction {
 
     /**
      * The {@code borrowObject()} method should block until a new
-     * object is available, or the {@link GenericKeyedObjectPool#getMaxWait maximum wait time}
-     * has been reached.
+     * object is available, or the
+     * {@link GenericKeyedObjectPool#getMaxWait maximum wait time} has been
+     * reached.
      */
     BLOCK,
 

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java Thu May 12 09:44:23 2011
@@ -109,7 +109,7 @@ public class TestGenericKeyedObjectPool 
     @Test
     public void testNegativeMaxActive() throws Exception {
         pool.setMaxActive(-1);
-        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
         String obj = pool.borrowObject("");
         assertEquals("0",obj);
         pool.returnObject("",obj);
@@ -203,7 +203,7 @@ public class TestGenericKeyedObjectPool 
     @Test
     public void testMaxActive() throws Exception {
         pool.setMaxActive(3);
-        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         pool.borrowObject("");
         pool.borrowObject("");
@@ -219,7 +219,7 @@ public class TestGenericKeyedObjectPool 
     @Test
     public void testMaxActiveZero() throws Exception {
         pool.setMaxActive(0);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         try {
             pool.borrowObject("a");
@@ -233,7 +233,7 @@ public class TestGenericKeyedObjectPool 
     public void testWhenExhaustedGrow() throws Exception {
         pool.setMaxActive(1);
         pool.setMaxTotal(1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.GROW);
         for (int i = 0; i < 10; i++) {
             pool.borrowObject("a");
         }
@@ -243,7 +243,7 @@ public class TestGenericKeyedObjectPool 
     public void testMaxTotal() throws Exception {
         pool.setMaxActive(2);
         pool.setMaxTotal(3);
-        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         String o1 = pool.borrowObject("a");
         assertNotNull(o1);
@@ -284,7 +284,7 @@ public class TestGenericKeyedObjectPool 
     @Test
     public void testMaxTotalZero() throws Exception {
         pool.setMaxTotal(0);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         try {
             pool.borrowObject("a");
@@ -298,7 +298,7 @@ public class TestGenericKeyedObjectPool 
     public void testMaxTotalLRU() throws Exception {
         pool.setMaxActive(2);
         pool.setMaxTotal(3);
-//        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW);
+//        pool.setWhenExhaustedAction(WhenExhaustedAction.GROW);
 
         String o1 = pool.borrowObject("a");
         assertNotNull(o1);
@@ -393,12 +393,12 @@ public class TestGenericKeyedObjectPool 
             assertEquals(11235L,pool.getTimeBetweenEvictionRunsMillis());
         }
         {
-            pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK,pool.getWhenExhaustedAction());
-            pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL,pool.getWhenExhaustedAction());
-            pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
+            assertEquals(WhenExhaustedAction.BLOCK,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
+            assertEquals(WhenExhaustedAction.FAIL,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+            assertEquals(WhenExhaustedAction.GROW,pool.getWhenExhaustedAction());
         }
     }
 
@@ -1027,7 +1027,7 @@ public class TestGenericKeyedObjectPool 
         boolean testOnReturn = true;
         boolean testWhileIdle = true;
         long timeBetweenEvictionRunsMillis = 8;
-        byte whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+        WhenExhaustedAction whenExhaustedAction = WhenExhaustedAction.GROW;
         boolean lifo = false;
         
         GenericKeyedObjectPool<Object,Object> pool = new GenericKeyedObjectPool<Object,Object>();
@@ -1364,7 +1364,7 @@ public class TestGenericKeyedObjectPool 
     public void testBlockedKeyDoesNotBlockPool() throws Exception {
         SimpleFactory<String> factory = new SimpleFactory<String>();
         GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setMaxWait(5000);
         pool.setMaxActive(1);
         pool.setMaxTotal(-1);
@@ -1409,7 +1409,7 @@ public class TestGenericKeyedObjectPool 
         final int threadsPerKey = 5; // number of threads to grab the key initially
         SimpleFactory<String> factory = new SimpleFactory<String>();
         GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setMaxWait(maxWait);
         pool.setMaxActive(threadsPerKey);
         // Create enough threads so half the threads will have to wait

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericKeyedObjectPoolFactory.java Thu May 12 09:44:23 2011
@@ -55,7 +55,7 @@ public class TestGenericKeyedObjectPoolF
         config.testOnReturn = false;
         config.testWhileIdle = true;
         config.timeBetweenEvictionRunsMillis = 8;
-        config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+        config.whenExhaustedAction = WhenExhaustedAction.GROW;
         config.lifo = false;
         factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), config);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
@@ -70,7 +70,7 @@ public class TestGenericKeyedObjectPoolF
         assertEquals(true, pool.getTestWhileIdle());
         assertEquals(false, pool.getLifo());
         assertEquals(8, pool.getTimeBetweenEvictionRunsMillis());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
@@ -80,55 +80,55 @@ public class TestGenericKeyedObjectPoolF
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.BLOCK, 125);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.BLOCK, pool.getWhenExhaustedAction());
         assertEquals(125, pool.getMaxWait());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, true, false);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, 4);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
         assertEquals(4, pool.getMaxTotal());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, true, false);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, true, false, 4, 5, 6, false);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -139,11 +139,11 @@ public class TestGenericKeyedObjectPoolF
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
         assertEquals(false, pool.getTestWhileIdle());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
 
 
-        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        factory = new GenericKeyedObjectPoolFactory<Object,Object>(createObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true);
         pool = (GenericKeyedObjectPool<Object,Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -155,7 +155,7 @@ public class TestGenericKeyedObjectPoolF
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
         assertEquals(true, pool.getTestWhileIdle());
-        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.close();
     }
 }

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPool.java Thu May 12 09:44:23 2011
@@ -78,7 +78,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testWhenExhaustedGrow() throws Exception {
         pool.setMaxActive(1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.GROW);
         Object obj1 = pool.borrowObject();
         assertNotNull(obj1);
         Object obj2 = pool.borrowObject();
@@ -91,7 +91,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testWhenExhaustedFail() throws Exception {
         pool.setMaxActive(1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
         Object obj1 = pool.borrowObject();
         assertNotNull(obj1);
         try {
@@ -108,7 +108,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testWhenExhaustedBlock() throws Exception {
         pool.setMaxActive(1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setMaxWait(10L);
         Object obj1 = pool.borrowObject();
         assertNotNull(obj1);
@@ -125,7 +125,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testWhenExhaustedBlockInterupt() throws Exception {
         pool.setMaxActive(1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setMaxWait(0);
         Object obj1 = pool.borrowObject();
         
@@ -512,7 +512,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testNegativeMaxActive() throws Exception {
         pool.setMaxActive(-1);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
         Object obj = pool.borrowObject();
         assertEquals(getNthObject(0),obj);
         pool.returnObject(obj);
@@ -555,7 +555,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testMaxActive() throws Exception {
         pool.setMaxActive(3);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         pool.borrowObject();
         pool.borrowObject();
@@ -572,7 +572,7 @@ public class TestGenericObjectPool exten
     public void testTimeoutNoLeak() throws Exception {
         pool.setMaxActive(2);
         pool.setMaxWait(10);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         Object obj = pool.borrowObject();
         Object obj2 = pool.borrowObject();
         try {
@@ -591,7 +591,7 @@ public class TestGenericObjectPool exten
     @Test
     public void testMaxActiveZero() throws Exception {
         pool.setMaxActive(0);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
 
         try {
             pool.borrowObject();
@@ -613,7 +613,7 @@ public class TestGenericObjectPool exten
         factory.setMaxActive(maxActive);
         pool.setFactory(factory);
         pool.setMaxActive(maxActive);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setTimeBetweenEvictionRunsMillis(-1);
         
         // Start threads to borrow objects
@@ -681,36 +681,6 @@ public class TestGenericObjectPool exten
     }
 
     @Test
-    public void testInvalidWhenExhaustedAction() throws Exception {
-        try {
-            pool.setWhenExhaustedAction(Byte.MAX_VALUE);
-            fail("Expected IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
-            // expected
-        }
-
-        try {
-            ObjectPool<Object> pool = new GenericObjectPool<Object>(
-                new SimpleFactory(),
-                GenericObjectPool.DEFAULT_MAX_ACTIVE, 
-                Byte.MAX_VALUE,
-                GenericObjectPool.DEFAULT_MAX_WAIT, 
-                GenericObjectPool.DEFAULT_MAX_IDLE,
-                false,
-                false,
-                GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
-                GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN,
-                GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
-                false
-            );
-            assertNotNull(pool);
-            fail("Expected IllegalArgumentException");
-        } catch(IllegalArgumentException e) {
-            // expected
-        }
-    }
-
-    @Test
     public void testSettersAndGetters() throws Exception {
         GenericObjectPool<Object> pool = new GenericObjectPool<Object>();
         {
@@ -763,12 +733,12 @@ public class TestGenericObjectPool exten
             assertEquals(12135L,pool.getSoftMinEvictableIdleTimeMillis());
         }
         {
-            pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK,pool.getWhenExhaustedAction());
-            pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_FAIL);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL,pool.getWhenExhaustedAction());
-            pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
-            assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
+            assertEquals(WhenExhaustedAction.BLOCK,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.FAIL);
+            assertEquals(WhenExhaustedAction.FAIL,pool.getWhenExhaustedAction());
+            pool.setWhenExhaustedAction(WhenExhaustedAction.GROW);
+            assertEquals(WhenExhaustedAction.GROW,pool.getWhenExhaustedAction());
         }
     }
     
@@ -799,7 +769,7 @@ public class TestGenericObjectPool exten
             expected.testOnReturn = true;
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected);
             assertConfiguration(expected,pool);
         }
@@ -813,7 +783,7 @@ public class TestGenericObjectPool exten
             GenericObjectPool.Config expected = new GenericObjectPool.Config();
             expected.maxActive = 2;
             expected.maxWait = 5L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait);
             assertConfiguration(expected,pool);
         }
@@ -823,7 +793,7 @@ public class TestGenericObjectPool exten
             expected.maxWait = 5L;
             expected.testOnBorrow = true;
             expected.testOnReturn = true;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.testOnBorrow,expected.testOnReturn);
             assertConfiguration(expected,pool);
         }
@@ -832,7 +802,7 @@ public class TestGenericObjectPool exten
             expected.maxActive = 2;
             expected.maxIdle = 3;
             expected.maxWait = 5L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle);
             assertConfiguration(expected,pool);
         }
@@ -841,7 +811,7 @@ public class TestGenericObjectPool exten
             expected.maxActive = 2;
             expected.maxIdle = 3;
             expected.maxWait = 5L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             expected.testOnBorrow = true;
             expected.testOnReturn = true;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive,expected.whenExhaustedAction,expected.maxWait,expected.maxIdle,expected.testOnBorrow,expected.testOnReturn);
@@ -858,7 +828,7 @@ public class TestGenericObjectPool exten
             expected.testOnReturn = true;
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
             assertConfiguration(expected,pool);
         }
@@ -874,7 +844,7 @@ public class TestGenericObjectPool exten
             expected.testOnReturn = true;
             expected.testWhileIdle = true;
             expected.timeBetweenEvictionRunsMillis = 11L;
-            expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+            expected.whenExhaustedAction = WhenExhaustedAction.GROW;
             GenericObjectPool<Object> pool = new GenericObjectPool<Object>(null,expected.maxActive, expected.whenExhaustedAction, expected.maxWait, expected.maxIdle, expected.minIdle, expected.testOnBorrow, expected.testOnReturn, expected.timeBetweenEvictionRunsMillis, expected.numTestsPerEvictionRun, expected.minEvictableIdleTimeMillis, expected.testWhileIdle);
             assertConfiguration(expected,pool);
         }
@@ -894,7 +864,7 @@ public class TestGenericObjectPool exten
         expected.testOnReturn = true;
         expected.testWhileIdle = true;
         expected.timeBetweenEvictionRunsMillis = 11L;
-        expected.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+        expected.whenExhaustedAction = WhenExhaustedAction.GROW;
         pool.setConfig(expected);
         assertConfiguration(expected,pool);
     }
@@ -1615,7 +1585,7 @@ public class TestGenericObjectPool exten
         factory.setMaxActive(maxActive);
         pool.setFactory(factory);
         pool.setMaxActive(maxActive);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setTimeBetweenEvictionRunsMillis(-1);
 
         // Start threads to borrow objects
@@ -1660,7 +1630,7 @@ public class TestGenericObjectPool exten
         factory.setMaxActive(maxActive);
         pool.setFactory(factory);
         pool.setMaxActive(maxActive);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setTestOnBorrow(true);
         
         // First borrow object will need to create a new object which will fail
@@ -1756,7 +1726,7 @@ public class TestGenericObjectPool exten
         final int threads = 10; // number of threads to grab the object initially
         SimpleFactory factory = new SimpleFactory();
         GenericObjectPool<Object> pool = new GenericObjectPool<Object>(factory);
-        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        pool.setWhenExhaustedAction(WhenExhaustedAction.BLOCK);
         pool.setMaxWait(maxWait);
         pool.setMaxActive(threads);
         // Create enough threads so half the threads will have to wait

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java?rev=1102216&r1=1102215&r2=1102216&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestGenericObjectPoolFactory.java Thu May 12 09:44:23 2011
@@ -61,7 +61,7 @@ public class TestGenericObjectPoolFactor
         config.testWhileIdle = true;
         config.lifo = false;
         config.timeBetweenEvictionRunsMillis = 8;
-        config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
+        config.whenExhaustedAction = WhenExhaustedAction.GROW;
         factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), config);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
@@ -76,7 +76,7 @@ public class TestGenericObjectPoolFactor
         assertEquals(true, pool.getTestWhileIdle());
         assertEquals(false, pool.getLifo());
         assertEquals(8, pool.getTimeBetweenEvictionRunsMillis());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
@@ -88,10 +88,10 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_BLOCK, 125);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.BLOCK, 125);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_BLOCK, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.BLOCK, pool.getWhenExhaustedAction());
         assertEquals(125, pool.getMaxWait());
         pool.borrowObject();
         long startTime = System.currentTimeMillis();
@@ -106,40 +106,40 @@ public class TestGenericObjectPoolFactor
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, true, false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, true, false);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, true, false);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
         assertEquals(3, pool.getMaxIdle());
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, true, false, 4, 5, 6, false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, true, false, 4, 5, 6, false);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -150,12 +150,12 @@ public class TestGenericObjectPoolFactor
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
         assertEquals(false, pool.getTestWhileIdle());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -167,12 +167,12 @@ public class TestGenericObjectPoolFactor
         assertEquals(true, pool.getTestOnBorrow());
         assertEquals(false, pool.getTestOnReturn());
         assertEquals(true, pool.getTestWhileIdle());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
 
 
-        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, GenericObjectPool.WHEN_EXHAUSTED_GROW, 2, 3, 4, true, false, 5, 6, 7, true, 8, false);
+        factory = new GenericObjectPoolFactory<Object>(new MethodCallPoolableObjectFactory(), 1, WhenExhaustedAction.GROW, 2, 3, 4, true, false, 5, 6, 7, true, 8, false);
         pool = (GenericObjectPool<Object>)factory.createPool();
         assertEquals(1, pool.getMaxActive());
         assertEquals(2, pool.getMaxWait());
@@ -186,7 +186,7 @@ public class TestGenericObjectPoolFactor
         assertEquals(false, pool.getTestOnReturn());
         assertEquals(true, pool.getTestWhileIdle());
         assertEquals(false, pool.getLifo());
-        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_GROW, pool.getWhenExhaustedAction());
+        assertEquals(WhenExhaustedAction.GROW, pool.getWhenExhaustedAction());
         pool.borrowObject();
         pool.close();
     }



Mime
View raw message