• The java.lang.ThreadLocal [2] allows thread-specific variables to be added in an ad-hoc fasion to just about any code.
  • The ThreadLocal class maintains a table associating data (Object references) with Thread instances. ThreadLocal supports set and get methods to access data held by the current Thread. [1]
  • The following example is from [3] . When running the program notice that the ThreadLocal variable in column one remains the same throughout the program's run.

More Examples on Java


More Examples of ThreadLocal in the Following Books

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.