commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1331997 - in /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl: BaseGenericObjectPool.java GenericKeyedObjectPool.java GenericObjectPool.java
Date Sun, 29 Apr 2012 21:05:11 GMT
Author: markt
Date: Sun Apr 29 21:05:10 2012
New Revision: 1331997

URL: http://svn.apache.org/viewvc?rev=1331997&view=rev
Log:
Pull up maxWaitMillis
Fix a few volatiles missed in previous pull-ups

Modified:
    commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.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

Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java?rev=1331997&r1=1331996&r2=1331997&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java
Sun Apr 29 21:05:10 2012
@@ -52,9 +52,12 @@ public abstract class BaseGenericObjectP
     private static final int SWALLOWED_EXCEPTION_QUEUE_SIZE = 10;
 
     // Configuration attributes
-    private int maxTotal = GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
+    private volatile int maxTotal =
+            GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL;
     private volatile boolean blockWhenExhausted =
-        GenericObjectPoolConfig.DEFAULT_BLOCK_WHEN_EXHAUSTED;
+            GenericObjectPoolConfig.DEFAULT_BLOCK_WHEN_EXHAUSTED;
+    private volatile long maxWaitMillis =
+            GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
 
 
     // Internal (primarily state) attributes
@@ -150,10 +153,43 @@ public abstract class BaseGenericObjectP
         this.blockWhenExhausted = blockWhenExhausted;
     }
 
+    /**
+     * Returns the maximum amount of time (in milliseconds) the
+     * <code>borrowObject()</code> method should block before throwing an
+     * exception when the pool is exhausted and
+     * {@link #getBlockWhenExhausted} is true. When less than 0, the
+     * <code>borrowObject()</code> method may block indefinitely.
+     *
+     * @return the maximum number of milliseconds <code>borrowObject()</code>
+     * will block.
+     * @see #setMaxWaitMillis
+     * @see #setBlockWhenExhausted
+     */
+    public long getMaxWaitMillis() {
+        return maxWaitMillis;
+    }
+
+    /**
+     * Sets the maximum amount of time (in milliseconds) the
+     * <code>borrowObject()</code> method should block before throwing an
+     * exception when the pool is exhausted and
+     * {@link #getBlockWhenExhausted} is true. When less than 0, the
+     * <code>borrowObject()</code> method may block indefinitely.
+     *
+     * @param maxWaitMillis the maximum number of milliseconds
+     *                      <code>borrowObject()</code> will block or negative
+     *                      for indefinitely.
+     * @see #getMaxWaitMillis
+     * @see #setBlockWhenExhausted
+     */
+    public void setMaxWaitMillis(long maxWaitMillis) {
+        this.maxWaitMillis = maxWaitMillis;
+    }
+
 
     /**
-     * Closes the pool destroys the remaining idle objects and, if registered in
-     * JMX, deregisters it.
+     * Closes the pool, destroys the remaining idle objects and, if registered
+     * in JMX, deregisters it.
      */
     public abstract void close();
 

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=1331997&r1=1331996&r2=1331997&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
Sun Apr 29 21:05:10 2012
@@ -291,41 +291,6 @@ public class GenericKeyedObjectPool<K,T>
         this.maxTotalPerKey = maxTotalPerKey;
     }
 
-    /**
-     * Returns the maximum amount of time (in milliseconds) the
-     * {@link #borrowObject} method should block before throwing
-     * an exception when the pool is exhausted and the
-     * {@link #getBlockWhenExhausted} is true.
-     *
-     * When less than 0, the {@link #borrowObject} method
-     * may block indefinitely.
-     *
-     * @return the maximum number of milliseconds borrowObject will block.
-     * @see #setMaxWait
-     * @see #setBlockWhenExhausted
-     */
-    @Override
-    public long getMaxWaitMillis() {
-        return maxWaitMillis;
-    }
-
-    /**
-     * Sets the maximum amount of time (in milliseconds) the
-     * {@link #borrowObject} method should block before throwing
-     * an exception when the pool is exhausted and the
-     * {@link #getBlockWhenExhausted} is true.
-     *
-     * When less than 0, the {@link #borrowObject} method
-     * may block indefinitely.
-     *
-     * @param maxWaitMillis the maximum number of milliseconds borrowObject will
-     *                      block or negative for indefinitely.
-     * @see #getMaxWait
-     * @see #setBlockWhenExhausted
-     */
-    public void setMaxWaitMillis(long maxWaitMillis) {
-        this.maxWaitMillis = maxWaitMillis;
-    }
 
     /**
      * Returns the cap on the number of "idle" instances per key.
@@ -2044,22 +2009,6 @@ public class GenericKeyedObjectPool<K,T>
         GenericKeyedObjectPoolConfig.DEFAULT_MAX_TOTAL_PER_KEY;
 
     /**
-     * The maximum amount of time (in millis) the
-     * {@link #borrowObject} method should block before throwing
-     * an exception when the pool is exhausted and the
-     * {@link #getBlockWhenExhausted} is true.
-     *
-     * When less than 0, the {@link #borrowObject} method
-     * may block indefinitely.
-     *
-     * @see #setMaxWait
-     * @see #getMaxWait
-     * @see #setBlockWhenExhausted
-     * @see #getBlockWhenExhausted
-     */
-    private long maxWaitMillis = GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
-
-    /**
      * When <code>true</code>, objects will be
      * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
      * before being returned by the {@link #borrowObject}

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=1331997&r1=1331996&r2=1331997&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
Sun Apr 29 21:05:10 2012
@@ -233,37 +233,6 @@ public class GenericObjectPool<T> extend
     }
 
     /**
-     * Returns the maximum amount of time (in milliseconds) the
-     * {@link #borrowObject} method should block before throwing an exception
-     * when the pool is exhausted and the {@link #getBlockWhenExhausted} is true.
-     * When less than 0, the {@link #borrowObject} method may block indefinitely.
-     *
-     * @return maximum number of milliseconds to block when borrowing an object.
-     * @see #setMaxWaitMillis
-     * @see #setBlockWhenExhausted
-     */
-    @Override
-    public long getMaxWaitMillis() {
-        return maxWaitMillis;
-    }
-
-    /**
-     * Sets the maximum amount of time (in milliseconds) the
-     * {@link #borrowObject} method should block before throwing an exception
-     * when the pool is exhausted and the {@link #getBlockWhenExhausted} is true.
-     * When less than 0, the {@link #borrowObject} method may block indefinitely.
-     *
-     * @param maxWaitMillis
-     *            maximum number of milliseconds to block when borrowing an
-     *            object.
-     * @see #getMaxWaitMillis
-     * @see #getBlockWhenExhausted
-     */
-    public void setMaxWaitMillis(long maxWaitMillis) {
-        this.maxWaitMillis = maxWaitMillis;
-    }
-
-    /**
      * Returns the cap on the number of "idle" instances in the pool.
      *
      * @return the cap on the number of "idle" instances in the pool.
@@ -1378,21 +1347,6 @@ public class GenericObjectPool<T> extend
     private volatile int minIdle = GenericObjectPoolConfig.DEFAULT_MIN_IDLE;
 
     /**
-     * The maximum amount of time (in millis) the {@link #borrowObject} method
-     * should block before throwing an exception when the pool is exhausted and
-     * {@link #getBlockWhenExhausted()} is true.
-     * When less than 0, the
-     * {@link #borrowObject} method may block indefinitely.
-     *
-     * @see #setMaxWaitMillis
-     * @see #getMaxWaitMillis
-     * @see #setBlockWhenExhausted
-     * @see #getBlockWhenExhausted
-     */
-    private volatile long maxWaitMillis =
-            GenericObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
-
-    /**
      * When <tt>true</tt>, objects will be
      * {@link PoolableObjectFactory#validateObject validated} before being
      * returned by the {@link #borrowObject} method. If the object fails to



Mime
View raw message