On 3/30/07, David Smith <[EMAIL PROTECTED]> wrote:
Quoting the spec here (SRV.2.1 of servlet spec 2.4):

"The handling of concurrent requests to a Web application generally
requires that the Web Developer design servlets that can deal with
muiltiple threads executing within the service method at a particular time.

"Generally the Web container handles concurrent requests to the same
servlet by concurrent execution of the service method on different threads."

That right there suggests strongly that you should avoid class instance
variables.

On the thread front, the threads I believe are created by the connectors
to handle incoming requests.  Connector threads aren't tied to any
specific webapp or servlet.  They call the appropriate method of a
servlet and pass in a HttpServletRequest and HttpServletResponse object.


--David

David,

Thank you for your response. A further investigation of Tomcat source
code reveals that, indeed, the servlet definition class such as
`org.apache.catalina.core.StandardWrapper.java' implements a singleton
design in creation of each servlet (in allocate() method). Unless of
course, servlet implements a single thread model, in that case, a
stack structure is used to handle pool of such servlet instances.

What I am still inclined to figure out is at what location(s) does the
container creates threads to handle servlet requests/responses? I've
looked in `org.apache.catalina.core/connector' packages in vein. Does
anyone aware of such detail?

Thank You

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to