Author: markt
Date: Wed Apr 25 09:49:02 2012
New Revision: 1330173

URL: http://svn.apache.org/viewvc?rev=1330173&view=rev
Log:
maxWait -> maxWaitMillis for consistency

Modified:
    
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java
    
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
    
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
    
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java
    
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
    
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java

Modified: 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java
 (original)
+++ 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseObjectPoolConfig.java
 Wed Apr 25 09:49:02 2012
@@ -34,10 +34,10 @@ public abstract class BaseObjectPoolConf
 
     /**
      * The default value for the {@code maxWait} configuration attribute.
-     * @see GenericObjectPool#getMaxWait()
+     * @see GenericObjectPool#getMaxWaitMillis()
      * @see GenericKeyedObjectPool#getMaxWait()
      */
-    public static final long DEFAULT_MAX_WAIT = -1L;
+    public static final long DEFAULT_MAX_WAIT_MILLIS = -1L;
 
     /**
      * The default value for the {@code minEvictableIdleTimeMillis}
@@ -127,7 +127,7 @@ public abstract class BaseObjectPoolConf
 
     private boolean lifo = DEFAULT_LIFO;
 
-    private long maxWait = DEFAULT_MAX_WAIT;
+    private long maxWaitMillis = DEFAULT_MAX_WAIT_MILLIS;
 
     private long minEvictableIdleTimeMillis =
         DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;
@@ -179,21 +179,21 @@ public abstract class BaseObjectPoolConf
     /**
      * Get the value for the {@code maxWait} configuration attribute for pools
      * created with this configuration instance.
-     * @see GenericObjectPool#getMaxWait()
+     * @see GenericObjectPool#getMaxWaitMillis()
      * @see GenericKeyedObjectPool#getMaxWait()
      */
-    public long getMaxWait() {
-        return maxWait;
+    public long getMaxWaitMillis() {
+        return maxWaitMillis;
     }
 
     /**
      * Set the value for the {@code maxWait} configuration attribute for pools
      * created with this configuration instance.
-     * @see GenericObjectPool#getMaxWait()
+     * @see GenericObjectPool#getMaxWaitMillis()
      * @see GenericKeyedObjectPool#getMaxWait()
      */
-    public void setMaxWait(long maxWait) {
-        this.maxWait = maxWait;
+    public void setMaxWaitMillis(long maxWaitMillis) {
+        this.maxWaitMillis = maxWaitMillis;
     }
 
     /**

Modified: 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 (original)
+++ 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
 Wed Apr 25 09:49:02 2012
@@ -756,7 +756,7 @@ public class GenericKeyedObjectPool<K,T>
         setMaxTotalPerKey(conf.getMaxTotalPerKey());
         setMaxTotal(conf.getMaxTotal());
         setMinIdlePerKey(conf.getMinIdlePerKey());
-        setMaxWait(conf.getMaxWait());
+        setMaxWait(conf.getMaxWaitMillis());
         setBlockWhenExhausted(conf.getBlockWhenExhausted());
         setTestOnBorrow(conf.getTestOnBorrow());
         setTestOnReturn(conf.getTestOnReturn());
@@ -2282,7 +2282,7 @@ public class GenericKeyedObjectPool<K,T>
      * @see #setBlockWhenExhausted
      * @see #getBlockWhenExhausted
      */
-    private long maxWait = GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT;
+    private long maxWait = 
GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
 
     /**
      * When the {@link #borrowObject} method is invoked when the pool is

Modified: 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 (original)
+++ 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java
 Wed Apr 25 09:49:02 2012
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.commons.pool2.impl;
 
 import java.io.PrintWriter;
@@ -83,14 +82,14 @@ import org.apache.commons.pool2.Poolable
  * <li>When {@link #getBlockWhenExhausted} is true,
  * {@link #borrowObject} will block (invoke
  * {@link Object#wait()}) until a new or idle object is available. If a
- * non-negative {@link #setMaxWait <i>maxWait</i>} value is supplied, then
- * {@link #borrowObject} will block for at most that many milliseconds, after
- * which a {@link NoSuchElementException} will be thrown. If {@link #setMaxWait
- * <i>maxWait</i>} is negative, the {@link #borrowObject} method will block
- * indefinitely.</li>
+ * non-negative {@link #setMaxWaitMillis <i>maxWaitMillis</i>} value is
+ * supplied, then {@link #borrowObject} will block for at most that man
+ * milliseconds, after which a {@link NoSuchElementException} will be thrown. 
If
+ * {@link #setMaxWaitMillis <i>maxWaitMillis</i>} is negative, the
+ * {@link #borrowObject} method will block indefinitely.</li>
  * </ul>
  * The default {@link #getBlockWhenExhausted} is true
- * and the default <code>maxWait</code> setting is
+ * and the default <code>maxWaitMillis</code> setting is
  * -1. By default, therefore, <code>borrowObject</code> will block indefinitely
  * until an idle instance becomes available.</li>
  * <li>When {@link #setTestOnBorrow <i>testOnBorrow</i>} is set, the pool will
@@ -319,12 +318,12 @@ public class GenericObjectPool<T> extend
      * When less than 0, the {@link #borrowObject} method may block 
indefinitely.
      *
      * @return maximum number of milliseconds to block when borrowing an 
object.
-     * @see #setMaxWait
+     * @see #setMaxWaitMillis
      * @see #setBlockWhenExhausted
      */
     @Override
-    public long getMaxWait() {
-        return maxWait;
+    public long getMaxWaitMillis() {
+        return maxWaitMillis;
     }
 
     /**
@@ -333,14 +332,14 @@ public class GenericObjectPool<T> extend
      * when the pool is exhausted and the {@link #getBlockWhenExhausted} is 
true.
      * When less than 0, the {@link #borrowObject} method may block 
indefinitely.
      *
-     * @param maxWait
+     * @param maxWaitMillis
      *            maximum number of milliseconds to block when borrowing an
      *            object.
-     * @see #getMaxWait
+     * @see #getMaxWaitMillis
      * @see #getBlockWhenExhausted
      */
-    public void setMaxWait(long maxWait) {
-        this.maxWait = maxWait;
+    public void setMaxWaitMillis(long maxWaitMillis) {
+        this.maxWaitMillis = maxWaitMillis;
     }
 
     /**
@@ -698,7 +697,7 @@ public class GenericObjectPool<T> extend
         setMaxIdle(conf.getMaxIdle());
         setMinIdle(conf.getMinIdle());
         setMaxTotal(conf.getMaxTotal());
-        setMaxWait(conf.getMaxWait());
+        setMaxWaitMillis(conf.getMaxWaitMillis());
         setBlockWhenExhausted(conf.getBlockWhenExhausted());
         setTestOnBorrow(conf.getTestOnBorrow());
         setTestOnReturn(conf.getTestOnReturn());
@@ -738,7 +737,7 @@ public class GenericObjectPool<T> extend
      * If there are no idle instances available in the pool, behavior depends 
on
      * the {@link #getMaxTotal() maxTotal} and (if applicable)
      * {@link #getBlockWhenExhausted()} and
-     * {@link #getMaxWait() maxWait} properties. If the number of instances
+     * {@link #getMaxWaitMillis() maxWait} properties. If the number of 
instances
      * checked out from the pool is less than <code>maxActive,</code> a new
      * instance is created, activated and (if applicable) validated and 
returned
      * to the caller.
@@ -750,7 +749,7 @@ public class GenericObjectPool<T> extend
      * <code>NoSuchElementException</code> ({@link #getBlockWhenExhausted()} 
is false). The
      * length of time that this method will block when
      * {@link #getBlockWhenExhausted()} is true is determined by
-     * the {@link #getMaxWait() maxWait} property.
+     * the {@link #getMaxWaitMillis() maxWait} property.
      * </p>
      * <p>
      * When the pool is exhausted, multiple calling threads may be
@@ -765,20 +764,20 @@ public class GenericObjectPool<T> extend
      */
     @Override
     public T borrowObject() throws Exception {
-        return borrowObject(getMaxWait());
+        return borrowObject(getMaxWaitMillis());
     }
 
     /**
      * Borrow an object from the pool using a user specific waiting time which
      * only applies if {@link #getBlockWhenExhausted()} is true.
      *
-     * @param borrowMaxWait The time to wait in milliseconds for an object to
-     *                      become available
+     * @param borrowMaxWaitMillis   The time to wait in milliseconds for an
+     *                              object to become available
      * @return object instance
      * @throws NoSuchElementException
      *             if an instance cannot be returned
      */
-    public T borrowObject(long borrowMaxWait) throws Exception {
+    public T borrowObject(long borrowMaxWaitMillis) throws Exception {
         assertOpen();
 
         PooledObject<T> p = null;
@@ -799,11 +798,11 @@ public class GenericObjectPool<T> extend
                     p = create();
                 }
                 if (p == null) {
-                    if (borrowMaxWait < 0) {
+                    if (borrowMaxWaitMillis < 0) {
                         p = idleObjects.takeFirst();
                     } else {
                         waitTime = System.currentTimeMillis();
-                        p = idleObjects.pollFirst(borrowMaxWait,
+                        p = idleObjects.pollFirst(borrowMaxWaitMillis,
                                 TimeUnit.MILLISECONDS);
                         waitTime = System.currentTimeMillis() - waitTime;
                     }
@@ -1599,12 +1598,13 @@ public class GenericObjectPool<T> extend
      * When less than 0, the
      * {@link #borrowObject} method may block indefinitely.
      *
-     * @see #setMaxWait
-     * @see #getMaxWait
+     * @see #setMaxWaitMillis
+     * @see #getMaxWaitMillis
      * @see #setBlockWhenExhausted
      * @see #getBlockWhenExhausted
      */
-    private volatile long maxWait = GenericObjectPoolConfig.DEFAULT_MAX_WAIT;
+    private volatile long maxWaitMillis =
+            GenericObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
 
     /**
      * When the {@link #borrowObject} method is invoked when the pool is

Modified: 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java
 (original)
+++ 
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericObjectPoolMBean.java
 Wed Apr 25 09:49:02 2012
@@ -28,7 +28,7 @@ public interface GenericObjectPoolMBean 
     boolean getLifo();
     int getMaxIdle();
     int getMaxTotal();
-    long getMaxWait();
+    long getMaxWaitMillis();
     long getMinEvictableIdleTimeMillis();
     int getMinIdle();
     int getNumActive();

Modified: 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 (original)
+++ 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java
 Wed Apr 25 09:49:02 2012
@@ -1051,7 +1051,7 @@ public class TestGenericKeyedObjectPool 
             new GenericKeyedObjectPool<Object,Object>(null);
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL_PER_KEY, 
pool.getMaxTotalPerKey());
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_IDLE_PER_KEY, 
pool.getMaxIdlePerKey());
-        assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT, 
pool.getMaxWait());
+        assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS, 
pool.getMaxWait());
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MIN_IDLE_PER_KEY, 
pool.getMinIdlePerKey());
         assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL, 
pool.getMaxTotal());
         
assertEquals(GenericKeyedObjectPoolConfig.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
@@ -1078,7 +1078,7 @@ public class TestGenericKeyedObjectPool 
         config.setMaxIdlePerKey(maxIdle);
         config.setMinIdlePerKey(minIdle);
         config.setMaxTotal(maxTotal);
-        config.setMaxWait(maxWait);
+        config.setMaxWaitMillis(maxWait);
         config.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
         config.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
         config.setTestOnBorrow(testOnBorrow);

Modified: 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java?rev=1330173&r1=1330172&r2=1330173&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
 (original)
+++ 
commons/proper/pool/trunk/src/test/java/org/apache/commons/pool2/impl/TestGenericObjectPool.java
 Wed Apr 25 09:49:02 2012
@@ -131,7 +131,7 @@ public class TestGenericObjectPool exten
     public void testWhenExhaustedBlock() throws Exception {
         pool.setMaxTotal(1);
         pool.setBlockWhenExhausted(true);
-        pool.setMaxWait(10L);
+        pool.setMaxWaitMillis(10L);
         Object obj1 = pool.borrowObject();
         assertNotNull(obj1);
         try {
@@ -148,7 +148,7 @@ public class TestGenericObjectPool exten
     public void testWhenExhaustedBlockInterupt() throws Exception {
         pool.setMaxTotal(1);
         pool.setBlockWhenExhausted(true);
-        pool.setMaxWait(-1);
+        pool.setMaxWaitMillis(-1);
         Object obj1 = pool.borrowObject();
 
         // Make sure on object was obtained
@@ -171,7 +171,7 @@ public class TestGenericObjectPool exten
         pool.returnObject(obj1);
 
         // Bug POOL-162 - check there is now an object in the pool
-        pool.setMaxWait(10L);
+        pool.setMaxWaitMillis(10L);
         Object obj2 = null;
         try {
              obj2 = pool.borrowObject();
@@ -558,7 +558,7 @@ public class TestGenericObjectPool exten
     @Test(timeout=60000)
     public void testTimeoutNoLeak() throws Exception {
         pool.setMaxTotal(2);
-        pool.setMaxWait(10);
+        pool.setMaxWaitMillis(10);
         pool.setBlockWhenExhausted(true);
         Object obj = pool.borrowObject();
         Object obj2 = pool.borrowObject();
@@ -676,8 +676,8 @@ public class TestGenericObjectPool exten
             assertEquals(12,pool.getMaxIdle());
         }
         {
-            pool.setMaxWait(1234L);
-            assertEquals(1234L,pool.getMaxWait());
+            pool.setMaxWaitMillis(1234L);
+            assertEquals(1234L,pool.getMaxWaitMillis());
         }
         {
             pool.setMinEvictableIdleTimeMillis(12345L);
@@ -732,7 +732,7 @@ public class TestGenericObjectPool exten
         assertConfiguration(expected,pool);
         expected.setMaxTotal(2);
         expected.setMaxIdle(3);
-        expected.setMaxWait(5L);
+        expected.setMaxWaitMillis(5L);
         expected.setMinEvictableIdleTimeMillis(7L);
         expected.setNumTestsPerEvictionRun(9);
         expected.setTestOnBorrow(true);
@@ -1139,7 +1139,7 @@ public class TestGenericObjectPool exten
     public void testThreaded1() throws Exception {
         pool.setMaxTotal(15);
         pool.setMaxIdle(15);
-        pool.setMaxWait(1000L);
+        pool.setMaxWaitMillis(1000L);
         runTestThreads(20, 100, 50);
     }
 
@@ -1158,7 +1158,7 @@ public class TestGenericObjectPool exten
         pool.setMaxTotal(maxTotal);
         pool.setMaxIdle(-1);
         pool.setTestOnReturn(true);
-        pool.setMaxWait(1000L);
+        pool.setMaxWaitMillis(1000L);
         runTestThreads(5, 10, 50);
     }
 
@@ -1196,7 +1196,7 @@ public class TestGenericObjectPool exten
     public void testWhenExhaustedBlockClosePool() throws Exception {
         pool.setMaxTotal(1);
         pool.setBlockWhenExhausted(true);
-        pool.setMaxWait(-1);
+        pool.setMaxWaitMillis(-1);
         Object obj1 = pool.borrowObject();
 
         // Make sure an object was obtained
@@ -1390,7 +1390,7 @@ public class TestGenericObjectPool exten
         
assertEquals("whenExhaustedAction",expected.getBlockWhenExhausted(),actual.getBlockWhenExhausted());
         assertEquals("maxTotal",expected.getMaxTotal(),actual.getMaxTotal());
         assertEquals("maxIdle",expected.getMaxIdle(),actual.getMaxIdle());
-        assertEquals("maxWait",expected.getMaxWait(),actual.getMaxWait());
+        
assertEquals("maxWait",expected.getMaxWaitMillis(),actual.getMaxWaitMillis());
         
assertEquals("minEvictableIdleTimeMillis",expected.getMinEvictableIdleTimeMillis(),actual.getMinEvictableIdleTimeMillis());
         
assertEquals("numTestsPerEvictionRun",expected.getNumTestsPerEvictionRun(),actual.getNumTestsPerEvictionRun());
         
assertEquals("timeBetweenEvictionRunsMillis",expected.getTimeBetweenEvictionRunsMillis(),actual.getTimeBetweenEvictionRunsMillis());
@@ -1727,7 +1727,7 @@ public class TestGenericObjectPool exten
         final long holdTime = 2 * maxWait; // how long to hold connection
         final int threads = 10; // number of threads to grab the object 
initially
         pool.setBlockWhenExhausted(true);
-        pool.setMaxWait(maxWait);
+        pool.setMaxWaitMillis(maxWait);
         pool.setMaxTotal(threads);
         // Create enough threads so half the threads will have to wait
         WaitingTestThread wtt[] = new WaitingTestThread[threads * 2];


Reply via email to