Hi,
You're right that a static request dispatcher is a negligible
performance gain for a large thread-safety risk.  You can obviously test
it out with a client that will send multiple concurrent test requests.
But if you don't have the time or desire to test it out, you can know
that obtaining a request dispatcher is usually a low-latency operation
in Tomcat, and therefore the performance gain is not worth the risk.

Yoav Shapira http://www.yoavshapira.com


>-----Original Message-----
>From: Phil Shaw [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, December 08, 2004 7:59 AM
>To: [EMAIL PROTECTED]
>Subject: Thread safety for RequestDispatcher
>
>I'm looking at design options for a servlet that uses forwarding. If
>I were to get a RequestDispatcher in the init method (from
>ServletContext) and store it as a static field, it would save getting
>a RequestDispatcher for every request object.
>
>That may minimise unnecessary repetition, but I wonder if it is safe
>to have multiple request threads forwarded via the same
>RequestDispatcher instance?
>
>Previous mailings say that forwarding should be handled by the same
>thread as the request. I couldn't find any guidance here or on the
>Web about multiple threads accessing the same RequestDispatcher.
>
>
>
>--
><URL:http://www.codestyle.org/>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to