tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <>
Subject Re: Simultaneous Requests to servlet
Date Thu, 27 Sep 2007 15:25:23 GMT
Christopher Schultz wrote:

>Hash: SHA1
>David Smith wrote:
>>As I understand it one instance of the servlet per webapp is accessed
>>from all threads in a reentrant manner.  This is why you normally can't
>>use any class instance variables in a servlet.
>While this is the most straightforward implementation of a servlet
>container, the servlet specification makes no guarantees whatsoever
>about the lifecycle of a specific servlet. The container is free to
>create a new instance of the servlet to handle every request, or to keep
>a single copy around for the life of the webapp. Or anything in between.

Yup.... and all the more reason to store this synchronized data object 
in the servlet context, implementing logic to make it thread-safe.

>The only guarantee made along these lines is for servlets that implement
>SingleThreadModel, which will either require serialized access or
>multiple instances to handle requests. Since this has been deprecated
>but not removed from the spec, I'll bet it will continue to be supported
>forever, but it's not a very good idea IMO.
>- -chris
>Version: GnuPG v1.4.7 (MingW32)
>Comment: Using GnuPG with Mozilla -
>To start a new topic, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message