Author: psteitz
Date: Mon Apr 12 12:09:10 2010
New Revision: 933207
URL: http://svn.apache.org/viewvc?rev=933207&view=rev
Log:
Javadoc only.
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java?rev=933207&r1=933206&r2=933207&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
Mon Apr 12 12:09:10 2010
@@ -867,9 +867,20 @@ public final class PoolUtils {
}
}
+ /**
+ * Adapts an ObjectPool to implement KeyedObjectPool by ignoring key
arguments.
+ */
private static class KeyedObjectPoolAdaptor implements KeyedObjectPool {
+
+ /** Underlying pool */
private final ObjectPool pool;
+ /**
+ * Create a new KeyedObjectPoolAdaptor wrapping the given ObjectPool
+ *
+ * @param pool underlying object pool
+ * @throws IllegalArgumentException if pool is null
+ */
KeyedObjectPoolAdaptor(final ObjectPool pool) throws
IllegalArgumentException {
if (pool == null) {
throw new IllegalArgumentException("pool must not be null.");
@@ -877,10 +888,22 @@ public final class PoolUtils {
this.pool = pool;
}
+ /**
+ * Borrow and object from the pool, ignoring the key
+ *
+ * @param key ignored
+ * @return newly created object instance
+ */
public Object borrowObject(final Object key) throws Exception,
NoSuchElementException, IllegalStateException {
return pool.borrowObject();
}
+ /**
+ * Return and object to the pool, ignoring the key
+ *
+ * @param key ignored
+ * @param obj object to return
+ */
public void returnObject(final Object key, final Object obj) {
try {
pool.returnObject(obj);
@@ -889,6 +912,12 @@ public final class PoolUtils {
}
}
+ /**
+ * Invalidate and object, ignoring the key
+ *
+ * @param obj object to invalidate
+ * @param key ignored
+ */
public void invalidateObject(final Object key, final Object obj) {
try {
pool.invalidateObject(obj);
@@ -897,34 +926,68 @@ public final class PoolUtils {
}
}
+ /**
+ * Add an object to the pool, ignoring the key
+ *
+ * @param key ignored
+ */
public void addObject(final Object key) throws Exception,
IllegalStateException {
pool.addObject();
}
+ /**
+ * Return the number of objects idle in the pool, ignoring the key.
+ *
+ * @param key ignored
+ * @return idle instance count
+ */
public int getNumIdle(final Object key) throws
UnsupportedOperationException {
return pool.getNumIdle();
}
+ /**
+ * Return the number of objects checked out from the pool, ignoring
the key.
+ *
+ * @param key ignored
+ * @return active instance count
+ */
public int getNumActive(final Object key) throws
UnsupportedOperationException {
return pool.getNumActive();
}
+ /**
+ * {...@inheritdoc}
+ */
public int getNumIdle() throws UnsupportedOperationException {
return pool.getNumIdle();
}
+ /**
+ * {...@inheritdoc}
+ */
public int getNumActive() throws UnsupportedOperationException {
return pool.getNumActive();
}
+ /**
+ * {...@inheritdoc}
+ */
public void clear() throws Exception, UnsupportedOperationException {
pool.clear();
}
+ /**
+ * Clear the pool, ignoring the key (has same effect as {...@link
#clear()}.
+ *
+ * @param key ignored.
+ */
public void clear(final Object key) throws Exception,
UnsupportedOperationException {
pool.clear();
}
+ /**
+ * {...@inheritdoc}
+ */
public void close() {
try {
pool.close();
@@ -933,10 +996,19 @@ public final class PoolUtils {
}
}
+ /**
+ * Sets the factory used to manage objects.
+ *
+ * @param factory new factory to use managing object instances
+ * @deprecated to be removed in version 2.0
+ */
public void setFactory(final KeyedPoolableObjectFactory factory)
throws IllegalStateException, UnsupportedOperationException {
pool.setFactory(adapt(factory));
}
+ /**
+ * {...@inheritdoc}
+ */
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("KeyedObjectPoolAdaptor");