> From: Nikola Milutinovic [mailto:alok...@yahoo.com]
> Subject: Re: Right way to close database connection pool
> 
> I understand your point of view - you have that one web application
> and it is using the pool and you are seeing something that looks 
> like a leak.

If I understand the situation correctly, it not just looks like a leak - it is 
a leak.  Additional JVM heap space is consumed on each redeployment, as are the 
connections at the DB end.

> Take a look from Tomcat's perspective. It has a JNDI bound resource,
> DataSource in this case. TC has no way of knowing that that particular
> resource is being exclusively used by just that one application.

Yes, Tomcat does - the <Resource> element is within a specific <Context>.

> It can be used by several applications.

No, it's tied to the one webapp.

> On the other hand, even if it knew that the DS is being exclusively
> used by your web application, which has been undeployed at some point,
> why should it close (and then re-open) the DS?

The problem is that a *new* pool is opened on each redeployment.  If Tomcat 
simply reused the existing pool, there wouldn't be a problem.

One workaround for this is to declare the DBCP as a global resource in 
server.xml, so that a new one is not created on each redeployment.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to