commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James House <ja...@interobjective.com>
Subject [DBCP] possible correction for PoolingDataSource
Date Thu, 17 Jan 2002 21:33:10 GMT

Hi,

I have a proposed correction for the class PoolingDataSource.java

change this method:

     public synchronized Connection getConnection() throws SQLException {
         return (Connection)(_pool.borrowObject());
     }

to be like this:

     public synchronized Connection getConnection() throws SQLException {
        try {		
             return (Connection)(_pool.borrowObject());
        } catch(NoSuchElementException nsee) {
            throw new SQLException("No connection available in pool.");
        }
     }

This enables code to handle the exception thrown when there is an exhausted 
pool in the same manor as if the connection is invalid.

Comments/Thoughts?

James 


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message