You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Costas Stergiou <cs...@aias.gr> on 2001/04/12 12:32:40 UTC

[PATCH] Connection Pool

Just a small (but very important patch) for the 
ConnectionPool.releaseConnection method:

    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
        {
            try
            {
                dbconn.close();
            }
>>>           catch (SQLException ignored)
            {
                // ignored
            }
            decrementConnections();
        }
    }


The "catch (SQLException ignored)" should be replaced with 
"catch (Exception ignored)" since it may lead to connection hagning around
if a non-SQL exception occurs (it does happen in my case with Oracle
if I have first called DBConnection.close() on the connection and using
pooled connections).

Anyone to commit that for me?
Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Connection Pool

Posted by Daniel Rall <dl...@collab.net>.
Jon Stevens <jo...@latchkey.com> writes:

> I put the decrementConnections into a finally block. That should make sure
> it gets called correctly.

+1, this is a better fix.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: [PATCH] Connection Pool

Posted by Jon Stevens <jo...@latchkey.com>.
on 4/12/01 3:32 AM, "Costas Stergiou" <cs...@aias.gr> wrote:

> The "catch (SQLException ignored)" should be replaced with
> "catch (Exception ignored)" since it may lead to connection hagning around
> if a non-SQL exception occurs (it does happen in my case with Oracle
> if I have first called DBConnection.close() on the connection and using
> pooled connections).
> 
> Anyone to commit that for me?
> Thanks.

It would be nice if you actually sent a real patch. :-)

I put the decrementConnections into a finally block. That should make sure
it gets called correctly.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org