Tuyen Tran wrote:

> ----- Original Message -----
> From: Craig R. McClanahan <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 04, 1999 7:49 PM
> Subject: Re: Request Synchronization
>
> > >
> >
> > Servlet engines only serialize access to servlets that implement
> > SingleThreadModel.  For all other cases (either instance variables within
> a
> > servlet itself, or user objects stored in an HttpSession), you are
> responsible
> > for any synchronization that is required.
> >
> In the case of objects stored in an HttpSession, I'm not certain that
> SingleThreadModel will make your servlet thread-safe. The servlet engine is
> free to implement "SingleThreadModel" by have two or more instances of the
> servlet. In this case, you could still have two threads going through an
> object stored in HttpSession.
>

You are absolutely right, of course.  I was pointing out the one and only case
where the servlet engine promises to serialize requests -- but as you point
out the requests are serialized to a particular *instance* of an STM servlet,
not to the servlet itself.

Moral of the story:  do your own synchronization and locking on objects stored
in an HttpSession.

Craig

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to