"J~star Steqc_ou" <[EMAIL PROTECTED]> writes:
> The TurbineDB.getDB(String name) method should be changed to call the
> getPoolBroker.getDB(String)
> method:
> public static DB getDB(String name)
> throws Exception
> { //old code
> //return getPoolBroker().getDB();
>
> //new code
> return getPoolBroker().getDB(name);
> }
Gonzalo, I wonder if this was related to your issue of a couple weeks
ago? Nice work, Costas.
> The ConnectionPool.getPooledConnection() method(s) should be synchronized.
> (I think so)
There is a good chance that most of the methods are properly sync'd
internally, but I'll take a look.
> Here are some modified version of isValid() and releaseConnection() of the
> ConnectionPool class
> that will make the above code work (if without the s.close() statement):
>
> private boolean isValid( DBConnection connection )
> throws Exception
> {
> // Test whether the connection is valid and return the result.
> // return ( connection.getConnection() != null &&
> // !connection.getConnection().isClosed() &&
> // !isExpired(connection) );
>
> try
> {
> // just attempt to get the connection: if it is invalid, the
> // getConnection() method will throw SQLException
> connection.getConnection();
> return !isExpired(connection);
> }
> catch(SQLException sqle)
> {
> return false;
> }
> }
I very much like the addition of the try/catch block, but I would
prefer to leave the check for isClosed() in there as well.
> public synchronized void releaseConnection(DBConnection dbconn)
> throws Exception
> {
> // DBConnections MUST be unlinked when returned to the pool
> dbconn.unlink(this);
>
> if ( isValid(dbconn) )
> {
> pool.push(dbconn);
> notify();
> }
> else
> {
> //ignore error at this stage: you can rethrow it after
> decrementConnection() if you want to...
> try{
> dbconn.close();
> }catch(SQLException ignore){};
>
> decrementConnections();
> }
> }
>
>
>
> Sorry for the big e-mail, but I have no other way to communicate problems
> back to the list.
> Thanks for you patience
You were as clear as one can be without `cvs diff -u`. Thanks for the
additions.
--
Daniel Rall <[EMAIL PROTECTED]>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]