If your servlet doesn't implement SingleThreadModel, then it is actually
guaranteed by the Spec that there will be exactly one instance (per-Context)
that executes the request.

"John Corrigan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> No.
>
> Concurrent requests will most likely be be processed by the same instance
of
> your Servlet class, however it is not guarantted.
>
> -----Original Message-----
> From: G. Wade Johnson [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 09, 2003 9:43 AM
> To: Tomcat Users List
> Subject: Re: Servlet thread safety
>
>
> How about the flip side? Is instance data guaranteed separate for each
> request?
>
> I Have some code that relies on instance data and I just had the
> horrible realization that I have assumed that no two concurrent
> requests will be talking to the same object.
>
> Thanks again,
> G. Wade
>
> "Shapira, Yoav" wrote:
> >
> > Howdy,
> > You didn't miss it.  No such guarantee exists for normal servlets.  See
> > the javax.servlet.SingleThreadModel interface for one approach to this
> > issue.
> >
> > However, many people will tell you to avoid SingleThreadModel for
> > various reasons.  I tend to agree.  The design and implementation of
> > your servlets should not depend on the synchronization of their service
> > methods by the container.  If you have shared resources put them in
> > objects (often singletons) outside the servlets.
> >
> > Yoav Shapira
> > Millennium ChemInformatics
> >
> > >-----Original Message-----
> > >From: G. Wade Johnson [mailto:[EMAIL PROTECTED]
> > >Sent: Monday, June 09, 2003 12:08 PM
> > >To: Tomcat Users List
> > >Subject: Servlet thread safety
> > >
> > >This may be an obvious question, but is there any guarantee one way or
> > >the other about whether there is a separate servlet object for each
> > >concurrent request.
> > >
> > >In other words, is there any chance that instance data would be shared
> > >between two requests? If so, are we guaranteed if the instance data
> > will
> > >always be shared between two requests.
> > >
> > >I didn't see any, but I may just have missed it.
> > >
> > >G. Wade
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > 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]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to