Grokking Java Interview Questions
Vote

0% completed

​

ThreadLocal

A static field has one value, and all threads share it. A local variable has a separate value in each call, and other methods see it only when it is passed to them. Neither fits a value such as the id of the current request, which belongs to one thread and is needed by many of its methods.

A thread-local variable is a third kind. Every method can reach it like a static field, and each thread finds its own value in it. The questions begin with the place where this value is stored and the tasks it suits. They end with the errors it causes in a thread pool and with two related tools.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content