[concurrency-interest] Spring DispatcherServlet safe publication question

Jed Wesley-Smith jed at atlassian.com
Mon Mar 10 01:06:32 EDT 2008

Dhanji R. Prasanna wrote:

> On Mon, Mar 10, 2008 at 2:18 PM, Jed Wesley-Smith <jed at atlassian.com 
> <mailto:jed at atlassian.com>> wrote:
>     So, it has nothing to do with the Servlet spec - it's entirely down to
>     Spring.
> Well, where is spring obtaining it's init thread? =)
> Dhanji.

Actually, having a quick look at the code (rather than just wildly 
speculating), it does look like it is all actually initiated from the 
init method. In which case I don't know how or if Spring makes its usual 
ordering guarantees.

All that being said, as Jason points out the spec _does_ make some 
assurance of precedence although as Tim says this isn't _explicit_. 
SRV2.3.3 says: "After a servlet is properly initialized, the servlet 
container may use it to handle client
requests". The key being "after ... properly initialized" - I would 
posit that most servlet containers would implement a _happens before_ 
relationship here,  therefore all will be well. Otherwise they would 
certainly be open to the charge that they are not fulfilling the spec. I 
haven't had a look at any servlet container code though.


More information about the Concurrency-interest mailing list