You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2003/11/10 15:26:19 UTC
cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp PoolingDriver.java
dirkv 2003/11/10 06:26:19
Modified: dbcp/src/java/org/apache/commons/dbcp PoolingDriver.java
Log:
Bugzilla Bug 24562: PoolingDriver needs a closePool method
- add requested method
Revision Changes Path
1.8 +19 -6 jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolingDriver.java
Index: PoolingDriver.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolingDriver.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PoolingDriver.java 9 Oct 2003 21:04:44 -0000 1.7
+++ PoolingDriver.java 10 Nov 2003 14:26:19 -0000 1.8
@@ -106,7 +106,7 @@
*
* @deprecated This will be removed in a future version of DBCP.
*/
- synchronized public ObjectPool getPool(String name) {
+ public synchronized ObjectPool getPool(String name) {
try {
return getConnectionPool(name);
}
@@ -115,7 +115,7 @@
}
}
- synchronized protected ObjectPool getConnectionPool(String name) throws SQLException {
+ public synchronized ObjectPool getConnectionPool(String name) throws SQLException {
ObjectPool pool = (ObjectPool)(_pools.get(name));
if(null == pool) {
InputStream in = this.getClass().getResourceAsStream(String.valueOf(name) + ".jocl");
@@ -149,8 +149,21 @@
return pool;
}
- synchronized public void registerPool(String name, ObjectPool pool) {
+ public synchronized void registerPool(String name, ObjectPool pool) {
_pools.put(name,pool);
+ }
+
+ public synchronized void closePool(String name) throws SQLException {
+ ObjectPool pool = (ObjectPool) _pools.get(name);
+ if (pool != null) {
+ _pools.remove(name);
+ try {
+ pool.close();
+ }
+ catch (Exception e) {
+ throw new SQLNestedException("Error closing pool " + name, e);
+ }
+ }
}
public boolean acceptsURL(String url) throws SQLException {
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org