Mark Thomas wrote:
Remy Maucherat wrote:
[EMAIL PROTECTED] wrote:
Author: markt
Date: Mon Jan  1 11:31:29 2007
New Revision: 491619

URL: http://svn.apache.org/viewvc?view=rev&rev=491619
Log:
Port RD thread safety patch from TC5
I don't see any justification for this at the moment. Any further info ?

This started with http://marc.theaimsgroup.com/?t=116558790000003&r=1&w=2

The short version of the above thread is that a RD was obtained using
ServletContext.getNamedDispatcher() and then re-used. When multiple
requests used the RD at the same time, the request objects got mixed
up (since the RD is not thread safe) which in turn lead to an
occasional ISE when both threads tried to call getParameterMap() at
the same time on the same Request object.

There was some debate whether or not the spec intended RDs to be
re-used in this way. I couldn't see anything that explicitly
dis-allowed it; hence I implemented the patch.

I remember the issue (not from this thread).

I don't understand how a RD could be be used by multiple threads, as no objects provided by the servlet container are thread safe. If you add some sort of thread safety somewhere, then users will demand that all the other objects to be thread safe, which is not going to happen. If they want to reuse the request dispatcher somehow and use it without checking, then they should sync on it. I thought the pattern was to obtain a RD every time (which is slower, but that's what I saw pretty much everywhere).

There are a couple of places where the patch could be cleaner but I
opted to make the changes in a consistent way throughout the code so
it was clearer what the patch was doing. Cleaning this up is on my
list of things to do but I wanted to give people a chance to consider
the patch as-is first.

Rémy


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to