Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Please explain SRV.2.3.3.3 Thread Safety clause

Thread view: 
me.curious@yahoo.com - 28 Jan 2006 08:33 GMT
SRV.2.3.3.3 Thread Safety
Implementations of the request and response objects are not guaranteed
to be thread safe. This means that they should only be used within the
scope of the request handling thread. References to the request and
response objects must not be given to objects executing in other
threads as the resulting behavior may be nondeterministic.

My question is does a scenario arise often in practice? And if so,
could you let me know when.
hiwa - 28 Jan 2006 08:50 GMT
> does a scenario arise often in practice?
I only depends on you own (bad) coding practice.
Basically, request and response are arguments passed
to the servlet methods. You should keep them as they are.
curious - 28 Jan 2006 09:41 GMT
That's right,
But can u please further explain what practices can be bad in this
context?
That what all a developer should take care regarding this "CLAUSE" so
that his coding does not become bad.
John C. Bollinger - 29 Jan 2006 02:38 GMT
> That's right,
> But can u please further explain what practices can be bad in this
> context?

The text you quoted in the first place describes the constraints pretty
well.  You must not expose the request or response object to view by
other threads.  That could happen by storing one of them in the session
or application, by assigning one to a static or instance variable of a
servlet, by making one visible to a thread that you start yourself,
etc..  The list is infinite, but those are some of the most likely abuses.

> That what all a developer should take care regarding this "CLAUSE" so
> that his coding does not become bad.

A servlet (including JSPs) should not expose the request or response it
is handling to other threads (see above).  Furthermore, a servlet should
never rely on (or hold) a request or response past the end or servicing
the corresponding request.

Signature

John Bollinger
jobollin@indiana.edu

Thomas Hawtin - 28 Jan 2006 16:41 GMT
> SRV.2.3.3.3 Thread Safety
> Implementations of the request and response objects are not guaranteed
[quoted text clipped - 5 lines]
> My question is does a scenario arise often in practice? And if so,
> could you let me know when.

You'd be surprised at what some people will put in the session scope.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.