tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Donahue <>
Subject Question on Thread Local
Date Tue, 02 Sep 2014 19:47:51 GMT
I've been reading about using Thread Local in web applications and the
general use case is to generate a transaction id in a filter so that the
rest of the web application running in the thread local will have access to
that transaction id.

Thread Local is essentially a way to create a global variable so that you
don't have to create a bean that generates said global data and pass that
bean around to other classes, or inject it into the other classes?

I am not sure I understand the difference between per-thread requests and
servlet requests that already run in their own thread.

In other words, what is the difference between using a Thread Local
variable vs any other variable that is created inside a filter, or during a
normal servlet request?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message