You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/05/05 03:23:39 UTC
svn commit: r1334298 -
/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java
Author: sebb
Date: Sat May 5 01:23:39 2012
New Revision: 1334298
URL: http://svn.apache.org/viewvc?rev=1334298&view=rev
Log:
Some Javadoc
Modified:
commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java
Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java?rev=1334298&r1=1334297&r2=1334298&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java (original)
+++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/PooledObject.java Sat May 5 01:23:39 2012
@@ -22,6 +22,8 @@ package org.apache.commons.pool2.impl;
* <p>
* This class is intended to be thread-safe.
*
+ * @param <T> the type of object in the pool
+ *
* @version $Revision: $
*
* @since 2.0
@@ -140,6 +142,11 @@ public class PooledObject<T> implements
return false;
}
+ /**
+ * Allocates the object.
+ *
+ * @return {@code true} if the original state was {@link PooledObjectState#IDLE IDLE}
+ */
public synchronized boolean allocate() {
if (state == PooledObjectState.IDLE) {
state = PooledObjectState.ALLOCATED;
@@ -155,6 +162,12 @@ public class PooledObject<T> implements
return false;
}
+ /**
+ * Deallocates the object and sets it {@link PooledObjectState#IDLE IDLE}
+ * if it is currently {@link PooledObjectState#ALLOCATED ALLOCATED}.
+ *
+ * @return {@code true} if the state was {@link PooledObjectState#ALLOCATED ALLOCATED}
+ */
public synchronized boolean deallocate() {
if (state == PooledObjectState.ALLOCATED) {
state = PooledObjectState.IDLE;
@@ -165,6 +178,9 @@ public class PooledObject<T> implements
return false;
}
+ /**
+ * Sets the state to {@link PooledObjectState#INVALID INVALID}
+ */
public synchronized void invalidate() {
state = PooledObjectState.INVALID;
}