tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Newman" <>
Subject Re: Cleaning up servlets
Date Thu, 19 Apr 2001 09:50:25 GMT
Well, the servlet will get destroyed when the servelet is garbage collected
I think. The JVM has a garbage collection thread which starts up
automatically, and its its job to  cleanup unused objects. I'm not sure if
this behaviour changes in tomcat. You can explicitly call the garbage
collector by calling System.gc(),or something similar.
Note that something will only be garbage collected when nothing holds any
references to it (an  oversimplification I know). If you simply want to free
some resources up after a servlet is used, do this in your doPost/doGet

----- Original Message -----
From: "H.F.N. den Boer" <>
To: "Tomcat users group" <>
Sent: Thursday, April 19, 2001 10:42 AM
Subject: Cleaning up servlets

> When a servlet is destroyed, I log a number of things.
> >From the log I conclude that servlets are only destroyed when the NT
service is
> shut down manually.
> Do I need to run a separate process (thread) to monitor how long a servlet
> not used and from that process destroy it or is there some other way to
keep my
> environment clean ? Maybe a Tomcat setting ?

View raw message