<p>Are the threadlocals variables global to all the requests made to the servlet that owns the variables?</p>

<p>I am using resin for the server.</p>

<p>Thanks for awnser.</p>

<p>I think I can make my self more clear.</p>

<p><strong>The specific Case:</strong>  </p>

<p>I want to:</p>

<ul>
<li>initialize a static variable when the request starts the execution.</li>
<li>be able to query the value of the variable in the further executions of methods called from the servlet in a thread safety way until the request ends the execution</li>
</ul>

I think they are global to all requests made with that specific thread only. Other threads get other copies of the
thread-local
data. This is the key point of thread-local storage:
http://en.wikipedia.org/wiki/Thread-local_storage#Java
.
Unless you check the appropriate option in the servlets config, the servlet container will use your servlet with multiple threads to handle requests in parallel. So effectively you would have separate data for each thread that's up serving clients.
If your WebApplication isn't distributed (runs on multiple Java Virtual Machines), you can use the
```
ServletContext
```
object to store shared data across requests and threads (be sure to do proper locking then).