Hi,
I am have a web application that does a lot of processing. I have a
load on
startup servlet that will get init information for me.
when 2 users submit the form.. i noticed that one instance of the
servlet
is running and the other request waits for some time for
processor and just dies off.. Servlets are suppose to be thread safe
and
'n' number of intances can be created . why only one
instance running at a given time.. My servlet is not a single instance
servlet and i have not placed an restrictions of that sort..
can anyone help me with this ??
Your understanding of the how Servlet Spec dictates servlet instance
creation is incomplete. While n instances of a servlet *may* be created
by the container, that's not required, and that's only one way to manage
things. What Tomcat does is create one instance of each servlet for
every servlet tag in your web.xml, and then a pool of threads which
can use this servlet (aka the request processing threads).
So even though your servlet doesn't implement SingleThreadModel (I hope,
since that interface is gone, evil, and misleading), there's only one
instance of it. And you're responsible for synchronization as needed
for your domain-level objects and business processes.
Yoav Shapira http://www.yoavshapira.com
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to whom
it is addressed, and may not be saved, copied, printed, disclosed or used by
anyone else. If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender. Thank you.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]