commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r899609 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java
Date Fri, 15 Jan 2010 12:26:12 GMT
Author: sebb
Date: Fri Jan 15 12:26:11 2010
New Revision: 899609

URL: http://svn.apache.org/viewvc?rev=899609&view=rev
Log:
POOL-155 Clarify that invalidateObject should only be called on a failed object, not a failed
borrowObject.

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java?rev=899609&r1=899608&r2=899609&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/ObjectPool.java Fri Jan 15
12:26:11 2010
@@ -33,17 +33,21 @@
  *
  * <code style="color:#00C">try</code> {
  *     obj = pool.borrowObject();
- *     <code style="color:#0C0">//...use the object...</code>
+ *     <code style="color:#00C">try</code> {
+ *         <code style="color:#0C0">//...use the object...</code>
+ *     } <code style="color:#00C">catch</code>(Exception e) {
+ *         <code style="color:#0C0">// invalidate the object</code>
+ *         pool.invalidateObject(obj);
+ *         <code style="color:#0C0">// do not return the object to the pool twice</code>
+ *         obj = <code style="color:#00C">null</code>;
+ *     } <code style="color:#00C">finally</code> {
+ *         <code style="color:#0C0">// make sure the object is returned to the pool</code>
+ *         <code style="color:#00C">if</code>(<code style="color:#00C">null</code>
!= obj) {
+ *             pool.returnObject(obj);
+ *        }
+ *     }
  * } <code style="color:#00C">catch</code>(Exception e) {
- *     <code style="color:#0C0">// invalidate the object</code>
- *     pool.invalidateObject(obj);
- *     <code style="color:#0C0">// do not return the object to the pool twice</code>
- *     obj = <code style="color:#00C">null</code>;
- * } <code style="color:#00C">finally</code> {
- *     <code style="color:#0C0">// make sure the object is returned to the pool</code>
- *     <code style="color:#00C">if</code>(<code style="color:#00C">null</code>
!= obj) {
- *         pool.returnObject(obj);
- *    }
+ *       <code style="color:#0C0">// failed to borrow an object</code>
  * }</pre>
  * </p>
  *



Mime
View raw message