tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DAVIS, SCOTT A. (AIT)" <SCOTT.A.DA...@msg.ameritech.com>
Subject RE: Servlet unloading
Date Tue, 08 Aug 2000 17:42:04 GMT
Thanks for the suggestion, Jakob.  I've been trying to avoid connection
pooling since it seems rather complicated to do it correctly and
efficiently.  If connection pooling ends up a necessity to my project, I may
just bite the bullet and use a full application server.  I'd hate to have to
do that at this point, though.

I modified my database-accessing servlets so that at the beginning of each
doGet() or doPost() methods they check to see if their database connection
is valid and open.  If not, they try to create a new connection to the
database.  I'm hoping that this will resolve the problem for now.

Scott Davis
BORN
scott.a.davis@ameritech.com
scott.davis@born.com

-----Original Message-----
From: Jakob Hummes [mailto:hummes@castify.net]
Sent: Tuesday, August 08, 2000 10:26 AM
To: tomcat-user@jakarta.apache.org
Subject: Re: Servlet unloading

"DAVIS, SCOTT A. (AIT)" wrote:

> Is it possible to set the amount of time since a servlet is last accessed
> before Tomcat unloads the servlet from memory? 

This I don't know, but ...

> I'm working on a intranet application with a number of servlets which each
> open a connection to a remote database on initialization and close it when
> they are destroyed.  The remote database is rebooted at 5:30am each Monday
> morning, breaking any existing connections with the servlets.  Tomcat has
to
> restarted for the servlets to reconnect the next time they are accessed.

...you should rethink your design.  A better approach is to use a DB
connection pool.  It should check the status of a connection, and reopen
the connection if it is broken, before returning the connection to your
servlet.

HTH,
- Jakob

Mime
View raw message