aspose file tools
The moose likes JSP and the fly likes ThreadSafety of Request and Response Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "ThreadSafety of Request and Response Objects" Watch "ThreadSafety of Request and Response Objects" New topic
Author

ThreadSafety of Request and Response Objects

Deepan Devadasan
Ranch Hand

Joined: Jan 25, 2007
Posts: 226
Hi Friends,

Are Request and Response Objects thread when they are used out of the service() method..

What does this mean..and what are the situations the programmer has to be precautious when developing..

and is true that the Request and Response Objects shouldn't be referenced by objects executed by other threads?


Theepan Thevathasan
SCJP 1.4, SCWCD 1.4, SCMAD 1.0 SCBCD 1.3, MCP(.Net Frm 2.0 App Dev Fdn)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56192
    
  13

Originally posted by Theepan Thevathasan:

Are Request and Response Objects thread when they are used out of the service() method.


Yes. These objects are created and references within a single thread. Ergo, no thread-safety issues.

What does this mean..and what are the situations the programmer has to be precautious when developing..


It means you don't need to worry about any synchronization issues with these instances.

and is true that the Request and Response Objects shouldn't be referenced by objects executed by other threads?


Absolutely. Doing so would introduce all manner of threading issues.
[ February 01, 2007: Message edited by: Bear Bibeault ]

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Vivek Roy
Greenhorn

Joined: Jun 16, 2006
Posts: 11
And that is exactly on what servlet model is based on.

Thanks
Vivek
http://www.rangsamarpan.com/
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ThreadSafety of Request and Response Objects
 
Similar Threads
Life cycle of a servlet
Thread Safe
RequestDispatcher!
Error while testing attributes
Multithreading in servlet