title: ThreadLocal value access across different threads
body: <p>Given that a ThreadLocal variable holds different values for different threads, is it possible to access the value of one ThreadLocal variable from another thread? </p>
  
  <p>I.e. in the example code below, is it possible in <em>t1</em> to read the value of <em>TLocWrapper.tlint</em> from <em>t2</em>?</p>
  
  <pre><code>public class Example
  {
    public static void main (String[] args)
    {
      Tex t1 = new Tex("t1"), t2 = new Tex("t2");
      new Thread(t1).start();
      try
      {
        Thread.sleep(100);
      }
      catch (InterruptedException e)
      {}
      new Thread(t2).start();
      try
      {
        Thread.sleep(1000);
      }
      catch (InterruptedException e)
      {}
      t1.kill = true;
      t2.kill = true;
    }
  
    private static class Tex implements Runnable
    {
      final String name;
      Tex (String name)
      {
        this.name = name;
      }
      public boolean kill = false;
      public void run ()
      {
        TLocWrapper.get().tlint.set(System.currentTimeMillis());
        while (!kill)
        {
          // read value of tlint from TLocWrapper
          System.out.println(name + ": " + TLocWrapper.get().tlint.get());
        }
      }
    }
  }
  class TLocWrapper
  {
    public ThreadLocal&lt;Long&gt; tlint = new ThreadLocal&lt;Long&gt;();
    static final TLocWrapper self = new TLocWrapper();
    static TLocWrapper get ()
    {
      return self;
    }
    private TLocWrapper () {}
  }
  </code></pre>