tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: Right way to close database connection pool
Date Thu, 06 Aug 2009 13:09:18 GMT
> From: Nikola Milutinovic [mailto:alokin1@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message