Thanks for all your very useful replys.

We do all closing of resources in the destroy() method of our setup servlet.

We use the ConnectionFactoryPooledImpl so releasing of the resources used
should work fine.

I would have like to have used the ConnectionFactoryDBCPImpl as that is what
is used for the rest of the application (We have a connection pool used by
OJB and a connection pool for native SQL queries).

I cannot quite remember what the problem was, but it had something to with
Iterators not returning all objects or Collections being returned containing
no objects, but that’s better left for another time at the moment.

Now all I have to do is work out where the connection leak is in the
application connection pool.

The connection pool implementation uses DBCP. The code is similar to other
implementations I have looked at and is based on the OJB version.

It looks as though the leak may be in the code, but I have already gone over
it to match up the use of getConnection() methods with recycleConnection()
methods. All recycles are in finally methods.

I thought that the leak may be occuring in the DBCP code when it is making
sure that the maxIdle value is met and the connection is somehow just not
referenced anymore.

When the web context is shutdown there are connections left open, which can
be seen in the Database monitor. Once Tomcat is shutdown all the leftover
connections are closed. The finalize() methods are being called by the GC,
which in turn closes the connections, I think.

Any more suggestions?



> -----Original Message-----
> From: Martin Kalén [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 24 March 2005 8:56 p.m.
> To: OJB Users List
> Subject: Re: How to shutdown OJB when stopping web context.
> 
> 
> Greetings all,
> 
>   first off - all the different hints of how not to leave open 
> connections at webapp shutdown (ie using DBCP in Tomcat and 
> supply JNDI 
> DataSource to OJB, or explicitly calling release methods in OJB at 
> shutdown) are equally good ways of doing.
> 
> Danilo Tommasina wrote:
> > however it could be that the DBCP connection factory 
> implementation in
> > OJB 1.0.1 does not closes the connections when calling the 
> methods above.
> > I think Martin fixed this in OJB 1.0.2
> 
> That's correct. So if you are using DBCP as connection factory in 
> OJB.properties, releaseAllResources will not close the connections in 
> v1.0.1 or earlier.
> 
> Finally, for the sake of clarity: using a DBCP Connection 
> pool in Tomcat 
> and supplying a JNDI DataSource to OJB is not affected by 
> this since the 
> Connection management is then entirely left to Tomcat.
> 
> Regards,
>   Martin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to