-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chip,

On 7/26/12 3:19 PM, Chip McVey wrote:
> In TC7, is there a way to tell Tomcat to never unload a given
> servlet unless Tomcat itself is being shutdown?  I want a single
> servlet instance that I can know will exist for the life of the
> tomcat process without being unloaded & reloaded (unless someone
> manually instructs Tomcat to do so, of course).
> 
> Yes, I know I'm "not supposed to do this" and that the servlet
> spec says a container is allowed to unload a server any time as
> long as a request is not in process.  I still would like to know if
> there's some Tomcat specific way to tell TC7 to never unload the
> servlet. And yes, I realize even if there is such a way that future
> versions of Tomcat may remove this capability.  :)

You have said both "servlet" and "server": which did you mean?

Do you need a particular web application to stay loaded? That's easy:
simply don't undeploy it.

Do you need a single (or multiple) servlet(s) to stay loaded all the
time? That's also easy: I don't believe Tomcat ever actually unloads a
servlet. (You can easily test this by implementing the destroy()
method and emitting some kind of log).

What is it about the servlet that it needs to stay loaded? Servlets
aren't really supposed to have any state, so unloading and re-loading
the servlet shouldn't represent anything traumatic to your web
application.

If you have to have some kind of data loaded all the time, consider
moving that data into the ServletContext (aka "application")
attributes: then the servlet can be unloaded and re-loaded at will and
the data will persist.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlARnJ8ACgkQ9CaO5/Lv0PCaGQCgv7Kgkl04ElbBu5bkqNtuuX+v
5OsAn1MSf6i3CH9vIogXTb+aUKRYq0WN
=6vQK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to