An exception is now returned when there are no free connections in the pool.
This commit is contained in:
parent
eef219d37e
commit
dd8861d9f9
2 changed files with 14 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Source: /zpool01/javanet/scm/svn/tmp/cvs2svn/simplepool/src/net/java/dev/simplepool/SimplePool.java,v $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2004-03-28 02:04:57 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2004-03-30 02:10:16 $
|
||||
*
|
||||
* Copyright (c) 2002, Marc A. Mnich (http://www.javaexchange.com/)
|
||||
* All rights reserved.
|
||||
|
@ -33,7 +33,7 @@ import java.util.Date;
|
|||
* @author <a href="http://www.javaexchange.com/">Marc A. Mnich</a>
|
||||
* @author <a href="http://www.russellbeattie.com/">Russell Beattie</a>
|
||||
* @author <a href="http://www.thauvin.net/erik/">Erik C. Thauvin</a>
|
||||
* @version $Revision: 1.1 $, $Date: 2004-03-28 02:04:57 $
|
||||
* @version $Revision: 1.2 $, $Date: 2004-03-30 02:10:16 $
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SimplePool implements Runnable {
|
||||
|
@ -398,9 +398,10 @@ public class SimplePool implements Runnable {
|
|||
res = "freed " + conn.toString();
|
||||
log.debug("Freed connection [" + String.valueOf(thisconn) + ']');
|
||||
} else {
|
||||
log.error("Could not free connection [" + String.valueOf(thisconn) + ']');
|
||||
log.error("Could not free connection.");
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* $Source: /zpool01/javanet/scm/svn/tmp/cvs2svn/simplepool/src/net/java/dev/simplepool/SimplePoolConnection.java,v $
|
||||
* $Revision: 1.1 $
|
||||
* $Date: 2004-03-28 02:04:57 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2004-03-30 02:10:16 $
|
||||
*
|
||||
* Copyright (c) 2004, Russell Beattie (http://www.russellbeattie.com/)
|
||||
* All rights reserved.
|
||||
|
@ -47,7 +47,7 @@ import java.util.Map;
|
|||
*
|
||||
* @author <a href="http://www.russellbeattie.com/">Russell Beattie</a>
|
||||
* @author <a href="http://www.thauvin.net/erik/">Erik C. Thauvin</a>
|
||||
* @version $Revision: 1.1 $, $Date: 2004-03-28 02:04:57 $
|
||||
* @version $Revision: 1.2 $, $Date: 2004-03-30 02:10:16 $
|
||||
* @since 1.0
|
||||
*/
|
||||
public class SimplePoolConnection implements Connection {
|
||||
|
@ -60,9 +60,14 @@ public class SimplePoolConnection implements Connection {
|
|||
*
|
||||
* @param pool The connection pool.
|
||||
*/
|
||||
public SimplePoolConnection(SimplePool pool) {
|
||||
public SimplePoolConnection(SimplePool pool)
|
||||
throws SQLException {
|
||||
this.pool = pool;
|
||||
conn = pool.getConnection();
|
||||
if (conn == null)
|
||||
{
|
||||
throw new SQLException("No connections currently available in the pool.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue