Repository: commons-dbcp Updated Branches: refs/heads/master 012b164d1 -> 9eb1e0287
Javadoc and suppress a compiler warning. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/9eb1e028 Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/9eb1e028 Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/9eb1e028 Branch: refs/heads/master Commit: 9eb1e02873e9b56c55ac6b0bd253d5193de15b9c Parents: 012b164 Author: Gary Gregory <garydgreg...@gmail.com> Authored: Mon Jun 11 18:18:11 2018 -0600 Committer: Gary Gregory <garydgreg...@gmail.com> Committed: Mon Jun 11 18:18:11 2018 -0600 ---------------------------------------------------------------------- .../org/apache/commons/dbcp2/PoolingDriver.java | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/9eb1e028/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java b/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java index 730d9ba..4272943 100644 --- a/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java +++ b/src/main/java/org/apache/commons/dbcp2/PoolingDriver.java @@ -56,6 +56,9 @@ public class PoolingDriver implements Driver { /** Controls access to the underlying connection */ private final boolean accessToUnderlyingConnectionAllowed; + /** + * Constructs a new driver with <code>accessToUnderlyingConnectionAllowed</code> enabled. + */ public PoolingDriver() { this(true); } @@ -77,6 +80,15 @@ public class PoolingDriver implements Driver { return accessToUnderlyingConnectionAllowed; } + /** + * Gets the connection pool for the given name. + * + * @param name + * The pool name + * @return The pool + * @throws SQLException + * Thrown when the named pool is not registered. + */ public synchronized ObjectPool<? extends Connection> getConnectionPool(final String name) throws SQLException { final ObjectPool<? extends Connection> pool = pools.get(name); @@ -86,12 +98,29 @@ public class PoolingDriver implements Driver { return pool; } + /** + * Registers a named pool. + * + * @param name + * The pool name. + * @param pool + * The pool. + */ public synchronized void registerPool(final String name, final ObjectPool<? extends Connection> pool) { pools.put(name, pool); } + /** + * Closes a named pool. + * + * @param name + * The pool name. + * @throws SQLException + * Thrown when a problem is caught closing the pool. + */ public synchronized void closePool(final String name) throws SQLException { + @SuppressWarnings("resource") final ObjectPool<? extends Connection> pool = pools.get(name); if (pool != null) { pools.remove(name); @@ -104,6 +133,11 @@ public class PoolingDriver implements Driver { } } + /** + * Gets the pool names. + * + * @return the pool names. + */ public synchronized String[] getPoolNames(){ final Set<String> names = pools.keySet(); return names.toArray(new String[names.size()]);