tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G. Wade Johnson" <wade.john...@abbnm.com>
Subject Re: Servlet thread safety
Date Mon, 09 Jun 2003 16:43:07 GMT
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:wade.johnson@abbnm.com]
> >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: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message