Duane Morse wrote:
>
> If you don't allow independently working
> frames in the browser, and if you assume that the user won't open multiple
> browser windows,
> then you don't need synchronization -- there's only going to be one thread
> accessing the
> session data at a time in that framework.
>

 In addition to the multiple-browser-windows and
frames cases, there are other ways you can end up
with a single browser having multiple outstanding
requests:

 If a page returned by the servlet contains inline
resources also served by the servlet, the browser
may start several concurrent download threads. (That
can happen, for example, if you for some reason
have your servlet serving images)

 It can also happen that the user hits "back"
halfway through a page download, resulting
in (briefly) two outstanding requests to the
same servlet.

 It's probably never safe to assume that there
will be only one thread at a time accessing
your session data.

 The only safe courses of action are to serialize
access or make sure the underlying objects are
thread-safe.


-cks

___________________________________________________________________________
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