Please see the comment between the lines.

"Craig R. McClanahan" wrote:

> Howard Lee wrote:
>
> > Hi,
> >
> > I'm new to Servlet, and have a question about its life span. From what I've
> > read, servlets get loaded and it stays in web server's memory space. Does
> > this mean servlets stay in JVM and never get garbage collected?? I know
> > servlets have destroy method, and it gets called when the servlet gets
> > garbage collected. So if servlets stay in JVM, these methods will never get
> > called? Any help will be greatly appreciated. Thanks!
> >
>
> The server has the option to throw out a servlet instance any time it wants to
> (after calling the destroy() method).  For instance, it might decide that it's
> low on memory and servlet XYZ has not been called for a long time, so it can
> free up memory by destroying that instance.  In practice, most current servers
> do this only when you are shutting down the server, or if auto-reloading when
> a class changes (useful for development) is implemented.
>
> In between calls to init() and destroy() your servlet does stay in memory, but
> there is only one object instance -- it is used to handle all requests from
> all users that match the URL to which it is mapped.

This is probably JServ specific, but I can not see that servlets started
by the Apache and JServ behaves in this way.

I access my servlet from different hosts and the init() is obviously
executed for each of the requests (acording to my own logs and
jserv.log from JServ classes). Auto-reloading is disabled
(in my_zone.properties file from JServ).

Can it be that the ThreadPool in JServ (with bugs) has smth. to do
with this? I requested my servlets on Windows platform
using JRun and Netscape Enterprise before and then they behaved like
Craig described. So I switched to Linux and JServ and
it seems that I have to face the actual problem now (a lot
of users -> a lot of instances -> a lot of used memory -> ???).

This is worth to discuss, if it is not discussed before, of course.

janis


>
>
> >
> > howard
> >
>
> Craig McClanahan
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to