tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Romianowski" <p...@antaramusic.de>
Subject RE: on startup
Date Tue, 11 Sep 2001 11:26:13 GMT
> > This is safer than the typical approach (use the init() method of a
> > load-on-startup servlet), because the servlet specification does *not*
> > guarantee to keep any particular servlet instance in memory for the life
> > of the application (although Tomcat actually does so).
> > Craig

> Is this true?  Under what circumstances would a servlet be removed from
memory?

the specification does not guarantee that a servlet instance will be kept
all over the lifetime of the application. so it is implementation-dependent.
thus you can never be sure, that your servlet will be alive. i.e. a servlet
engine could remove a servlet if it has not been used for some amount of
time and recreate it when accessed again.
i dont know how other servlet engines handle this, but Craig is right when
he says that tomcat actually keeps the instance of a servlet but you
shouldn't rely on that (at least for the sake of portability)... and using
tomcat 4 his aproach is the by far the cleanest...

sincerly,
pero


Mime
View raw message