On Mar 15, 2013, at 4:05 PM, Mark Thomas wrote:

> On 15/03/2013 20:53, Nick Williams wrote:
>> If I understand this correctly (which I may not), BIO dedicates a
>> thread to a request from beginning to end and then recycles that
>> thread only when the request has completed (which is perfect), but
>> NIO and APR do not do that. More than one request may use a given
>> thread at (kind of) the same time. So my concern is that ThreadLocals
>> from one request could pollute ThreadLocals in another request. Is
>> this a concern, or are there reasons that won't happen?
> 
> Normally, all three connectors dedicate a thread to the processing of a
> request from beginning to end. You can safely use ThreadLocals in the
> manner you describe with any connector.
> 
> However, if you start to use Servlet 3.0 Async then you need to be a
> little more careful. Once you enter async mode ThreadLocals are almost
> certainly going to start causing problems. The same goes for Servlet 3.1
> non-blocking IO.
> 

Ahh. That makes sense. We are not currently using Async or non-blocking IO. We 
may at some point in the future. We will be sure to be careful with how we 
handle ThreadLocals at that point. Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to