commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <phil.ste...@gmail.com>
Subject Re: svn commit: r557176 - in /jakarta/commons/proper/dbcp/trunk: src/java/org/apache/commons/dbcp/ src/java/org/apache/commons/dbcp/cpdsadapter/ src/test/org/apache/commons/dbcp/ src/test/org/apache/commons/dbcp/managed/ xdocs/
Date Sat, 21 Jul 2007 17:49:43 GMT
On 7/19/07, Phil Steitz <phil.steitz@gmail.com> wrote:
> On 7/19/07, Dain Sundstrom <dain@iq80.com> wrote:
> > I think passivate() is called automatically when the connection is
> > put back in the pool (due to the _conn.close() call).  I think there
> > are tests that check that the statements were closed when the
> > connection is closed.
>
> OK, I will look at the tests and verify. The removed passivate is on
> the DelegatingConnection itself. The statement constructors add the
> created DelegatingStatements to the AbandonedTrace of the
> DelegatingConnection and its passivate walks the statements and closes
> them.  _con.close() is on the delegate.  You are probably right that
> the only resources that really matter get cleaned up in any case and
> if the tests show that, then this is no problem.
> >

This is OK.  PoolableConnectionFactory.passivateObject invokes
passivate on the DelegatingConnection.

Phil

> > Anyway, I don't think it is a big deal to call passivate twice.  It
> > used to cause a SQLException because the delegating statements would
> > throw an exception on the second close.
> >
> > -dain
> >
> >
> > On Jul 19, 2007, at 10:33 PM, Phil Steitz wrote:
> >
> > > Sorry I missed this in initial review.  I am not sure we want to
> > > remove the passivate() below, since that closes statements traced by
> > > this connection.  Am I missing something here?
> > >
> > > Phil
> > >
> > > jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/
> > > DelegatingConnection.java
> > > Tue Jul 17 23:46:16 2007
> > >> @@ -208,10 +208,17 @@
> > >>       * Closes the underlying connection, and close
> > >>       * any Statements that were not explicitly closed.
> > >>       */
> > >> -    public void close() throws SQLException
> > >> -    {
> > >> -        passivate();
> > >> -        _conn.close();
> > >> +    public void close() throws SQLException {
> > >> +        // close can be called multiple times, but
> > >> PoolableConnection improperly
> > >> +        // throws an exception when a connection is closed twice,
> > >> so before calling
> > >> +        // close we aren't alreayd closed
> > >> +        if (!isClosed()) {
> > >> +            try {
> > >> +                _conn.close();
> > >> +            } finally {
> > >> +                _closed = true;
> > >> +            }
> > >> +        }
> > >>      }
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
>

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


Mime
View raw message