DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13705>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13705 Add invalidateObject() method to ObjectPool ------- Additional Comments From [EMAIL PROTECTED] 2002-10-22 13:44 ------- below are the same diffs using "diff -u" *** pool/src/java/org/apache/commons/pool/ObjectPool.java Mon Oct 21 10:02:22 2002 --- pool/src/java/org/apache/commons/pool/ObjectPool.java.new Mon Oct 21 10:02:35 2002 *************** *** 116,121 **** --- 116,138 ---- void returnObject(Object obj) throws Exception; /** + * Invalidates an object from the pool + * By contract, <i>obj</i> MUST have been obtained + * using {@link #borrowObject() borrowObject} + * or a related method as defined in an implementation + * or sub-interface. + * <p> + * This method should be used when an object that has been borrowed + * is determined (due to an exception or other problem) to be invalid. + * If the connection should be validated before or after borrowing, + * then the {@link PoolableObjectFactory#validateObject} method should be + * used instead. + * + * @param obj a {@link #borrowObject() borrowed} instance to be returned. + */ + void invalidateObject(Object obj) throws Exception; + + /** * Return the number of instances * currently idle in my pool (optional operation). * This may be considered an approximation of the number *** pool/src/java/org/apache/commons/pool/BaseObjectPool.java Fri May 3 10:01:06 2002 --- pool/src/java/org/apache/commons/pool/BaseObjectPool.java.new Mon Oct 21 10:38:25 2002 *************** *** 72,77 **** --- 72,78 ---- public abstract class BaseObjectPool implements ObjectPool { public abstract Object borrowObject() throws Exception; public abstract void returnObject(Object obj) throws Exception; + public abstract void invalidateObject(Object obj) throws Exception; /** * @deprecated Use {@link #getNumIdle} instead. Will be removed by release 2.0. *** pool/src/java/org/apache/commons/pool/impl/GenericObjectPool.java Sat Aug 10 14:13:26 2002 --- pool/src/java/org/apache/commons/pool/impl/GenericObjectPool.java.new Mon Oct 21 10:04:56 2002 *************** *** 825,830 **** --- 825,836 ---- } } + public void invalidateObject(Object obj) throws Exception { + _numActive--; + notifyAll(); // _numActive has changed + _factory.destroyObject(obj); + } + synchronized public void close() throws Exception { clear(); _pool = null; *** pool/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java Mon Oct 21 10:06:41 2002 --- pool/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java.new Mon Oct 21 10:06:52 2002 *************** *** 152,157 **** --- 152,163 ---- } + public void invalidateObject(Object obj) throws Exception { + _numActive--; + notifyAll(); // _numActive has changed + _factory.destroyObject(obj); + } + /** Returns an approximation not less than the of the number of idle instances in the pool. */ public int getNumIdle() { return _pool.size(); *** pool/src/java/org/apache/commons/pool/impl/StackObjectPool.java Tue Apr 30 23:02:34 2002 --- pool/src/java/org/apache/commons/pool/impl/StackObjectPool.java.new Mon Oct 21 10:07:29 2002 *************** *** 205,210 **** --- 205,216 ---- } } + public void invalidateObject(Object obj) throws Exception { + _numActive--; + notifyAll(); // _numActive has changed + _factory.destroyObject(obj); + } + public int getNumIdle() { return _pool.size(); } -- To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>
