You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2012/04/30 11:27:54 UTC
svn commit: r1332135 - in
/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl:
BaseGenericObjectPool.java GenericKeyedObjectPool.java GenericObjectPool.java
Author: markt
Date: Mon Apr 30 09:27:53 2012
New Revision: 1332135
URL: http://svn.apache.org/viewvc?rev=1332135&view=rev
Log:
Pull up testOnBorrow and testOnReturn
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=1332135&r1=1332134&r2=1332135&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 Mon Apr 30 09:27:53 2012
@@ -58,6 +58,10 @@ public abstract class BaseGenericObjectP
GenericObjectPoolConfig.DEFAULT_BLOCK_WHEN_EXHAUSTED;
private volatile long maxWaitMillis =
GenericKeyedObjectPoolConfig.DEFAULT_MAX_WAIT_MILLIS;
+ private volatile boolean testOnBorrow =
+ GenericObjectPoolConfig.DEFAULT_TEST_ON_BORROW;
+ private volatile boolean testOnReturn =
+ GenericObjectPoolConfig.DEFAULT_TEST_ON_RETURN;
// Internal (primarily state) attributes
@@ -186,8 +190,68 @@ public abstract class BaseGenericObjectP
this.maxWaitMillis = maxWaitMillis;
}
+ /**
+ * Returns whether objects borrowed from the pool will be validated before
+ * being returned from the <code>borrowObject()</code> method. Validation is
+ * performed by the factory associated with the pool. If the object fails to
+ * validate, it will be dropped from the pool and destroyed, and a new
+ * attempt will be made to borrow an object from the pool.
+ *
+ * @return <code>true</code> if objects are validated before being returned
+ * from the <code>borrowObject()</code> method
+ * @see #setTestOnBorrow
+ */
+ public boolean getTestOnBorrow() {
+ return testOnBorrow;
+ }
+
+ /**
+ * Sets whether objects borrowed from the pool will be validated before
+ * being returned from the <code>borrowObject()</code> method. Validation is
+ * performed by the factory associated with the pool. If the object fails to
+ * validate, it will be dropped from the pool and destroyed, and a new
+ * attempt will be made to borrow an object from the pool.
+ *
+ * @param testOnBorrow <code>true</code> if objects should be validated
+ * before being returned from the
+ * <code>borrowObject()</code> method
+ * @see #getTestOnBorrow
+ */
+ public void setTestOnBorrow(boolean testOnBorrow) {
+ this.testOnBorrow = testOnBorrow;
+ }
/**
+ * Returns whether objects borrowed from the pool will be validated when
+ * they are returned to the pool via the <code>returnObject()</code> method.
+ * Validation is performed by the factory associated with the pool. If the
+ * object fails to it will be destroyed rather then returned the pool.
+ *
+ * @return <code>true</code> if objects are validated on being returned to
+ * the pool via the <code>returnObject()</code> method
+ * @see #setTestOnReturn
+ */
+ public boolean getTestOnReturn() {
+ return testOnReturn;
+ }
+
+ /**
+ * Sets whether objects borrowed from the pool will be validated when
+ * they are returned to the pool via the <code>returnObject()</code> method.
+ * Validation is performed by the factory associated with the pool. If the
+ * object fails to it will be destroyed rather then returned the pool.
+ *
+ * @param testOnReturn <code>true</code> if objects are validated on being
+ * returned to the pool via the
+ * <code>returnObject()</code> method
+ * @see #getTestOnReturn
+ */
+ public void setTestOnReturn(boolean testOnReturn) {
+ this.testOnReturn = testOnReturn;
+ }
+
+
+ /**
* Closes the pool, destroys the remaining idle objects and, if registered
* in JMX, deregisters it.
*/
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=1332135&r1=1332134&r2=1332135&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 Mon Apr 30 09:27:53 2012
@@ -366,64 +366,6 @@ public class GenericKeyedObjectPool<K,T>
}
/**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned by the {@link #borrowObject}
- * method. If the object fails to validate,
- * it will be dropped from the pool, and we will attempt
- * to borrow another.
- *
- * @return <code>true</code> if objects are validated before being borrowed.
- * @see #setTestOnBorrow
- */
- @Override
- public boolean getTestOnBorrow() {
- return testOnBorrow;
- }
-
- /**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned by the {@link #borrowObject}
- * method. If the object fails to validate,
- * it will be dropped from the pool, and we will attempt
- * to borrow another.
- *
- * @param testOnBorrow whether object should be validated before being returned by borrowObject.
- * @see #getTestOnBorrow
- */
- public void setTestOnBorrow(boolean testOnBorrow) {
- this.testOnBorrow = testOnBorrow;
- }
-
- /**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned to the pool within the
- * {@link #returnObject}.
- *
- * @return <code>true</code> when objects will be validated before being returned.
- * @see #setTestOnReturn
- */
- @Override
- public boolean getTestOnReturn() {
- return testOnReturn;
- }
-
- /**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned to the pool within the
- * {@link #returnObject}.
- *
- * @param testOnReturn <code>true</code> so objects will be validated before being returned.
- * @see #getTestOnReturn
- */
- public void setTestOnReturn(boolean testOnReturn) {
- this.testOnReturn = testOnReturn;
- }
-
- /**
* Returns the number of milliseconds to sleep between runs of the
* idle object evictor thread.
* When non-positive, no idle object evictor thread will be
@@ -2011,32 +1953,6 @@ public class GenericKeyedObjectPool<K,T>
/**
* When <code>true</code>, objects will be
* {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned by the {@link #borrowObject}
- * method. If the object fails to validate,
- * it will be dropped from the pool, and we will attempt
- * to borrow another.
- *
- * @see #setTestOnBorrow
- * @see #getTestOnBorrow
- */
- private volatile boolean testOnBorrow =
- GenericKeyedObjectPoolConfig.DEFAULT_TEST_ON_BORROW;
-
- /**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
- * before being returned to the pool within the
- * {@link #returnObject}.
- *
- * @see #getTestOnReturn
- * @see #setTestOnReturn
- */
- private volatile boolean testOnReturn =
- GenericKeyedObjectPoolConfig.DEFAULT_TEST_ON_RETURN;
-
- /**
- * When <code>true</code>, objects will be
- * {@link org.apache.commons.pool2.PoolableObjectFactory#validateObject validated}
* by the idle object evictor (if any). If an object
* fails to validate, it will be dropped from the pool.
*
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=1332135&r1=1332134&r2=1332135&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 Mon Apr 30 09:27:53 2012
@@ -303,65 +303,6 @@ public class GenericObjectPool<T> extend
}
/**
- * When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned by the {@link #borrowObject} method. If the object fails to
- * validate, it will be dropped from the pool, and we will attempt to borrow
- * another.
- *
- * @return <code>true</code> if objects are validated before being borrowed.
- * @see #setTestOnBorrow
- */
- @Override
- public boolean getTestOnBorrow() {
- return testOnBorrow;
- }
-
- /**
- * When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned by the {@link #borrowObject} method. If the object fails to
- * validate, it will be dropped from the pool, and we will attempt to borrow
- * another.
- *
- * @param testOnBorrow
- * <code>true</code> if objects should be validated before being
- * borrowed.
- * @see #getTestOnBorrow
- */
- public void setTestOnBorrow(boolean testOnBorrow) {
- this.testOnBorrow = testOnBorrow;
- }
-
- /**
- * When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned to the pool within the {@link #returnObject}.
- *
- * @return <code>true</code> when objects will be validated after returned
- * to {@link #returnObject}.
- * @see #setTestOnReturn
- */
- @Override
- public boolean getTestOnReturn() {
- return testOnReturn;
- }
-
- /**
- * When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned to the pool within the {@link #returnObject}.
- *
- * @param testOnReturn
- * <code>true</code> so objects will be validated after returned
- * to {@link #returnObject}.
- * @see #getTestOnReturn
- */
- public void setTestOnReturn(boolean testOnReturn) {
- this.testOnReturn = testOnReturn;
- }
-
- /**
* Returns the number of milliseconds to sleep between runs of the idle
* object evictor thread. When non-positive, no idle object evictor thread
* will be run.
@@ -1348,30 +1289,6 @@ public class GenericObjectPool<T> extend
/**
* When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned by the {@link #borrowObject} method. If the object fails to
- * validate, it will be dropped from the pool, and we will attempt to borrow
- * another.
- *
- * @see #setTestOnBorrow
- * @see #getTestOnBorrow
- */
- private volatile boolean testOnBorrow =
- GenericObjectPoolConfig.DEFAULT_TEST_ON_BORROW;
-
- /**
- * When <tt>true</tt>, objects will be
- * {@link PoolableObjectFactory#validateObject validated} before being
- * returned to the pool within the {@link #returnObject}.
- *
- * @see #getTestOnReturn
- * @see #setTestOnReturn
- */
- private volatile boolean testOnReturn =
- GenericObjectPoolConfig.DEFAULT_TEST_ON_RETURN;
-
- /**
- * When <tt>true</tt>, objects will be
* {@link PoolableObjectFactory#validateObject validated} by the idle object
* evictor (if any). If an object fails to validate, it will be dropped from
* the pool.