tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jess Holle <>
Subject javax.servlet.ServletRequest and thread safety...
Date Mon, 21 Nov 2011 22:37:07 GMT
First off, I know that as a *rule* javax.servlet.ServletRequest APIs are 
only intended to be called from one thread at a time and specifically 
(prior to 3.0 async APIs) from the servlet request thread and only 
during processing of that request.

All that said, there are lots of driving use cases from a management and 
monitoring perspective to be able to look at all requests in progress 
across all threads -- and to examine their request parameters, etc.

I have instrumentation along these lines via JMX at this point.  I 
*assumed* that calling getParameter*() APIs would be safe from any 
thread while the request was actively being processed -- and that race 
conditions in this use case would either be prevented or ensured to be 
harmless via careful coding, use of volatile, etc.  Now looking at 
org.apache.catalina.connector.Request in 6.0.33, for instance, it would 
appear that the request is significantly less thread safe than I'd have 

Is there an issue with multi-threaded access here or am I imagining things?

If there is an issue, (1) is it resolved in 7.0.x and (2) in 6.0.x can I 
just force invocation of getParameterMap() [etc?] prior to making the 
request visible to other threads?

Jess Holle

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message