@Test
  public void test() throws InterruptedException {
    final UnsafeThreadLocal<String> unsafeThreadLocal = new UnsafeThreadLocal<>();
    final CountDownLatch localSet = new CountDownLatch(1);

    Thread test = new Thread() {
      @Override
      public void run() {
        unsafeThreadLocal.set("hello");
        localSet.countDown();
        try {
          while (sleep) {
            Thread.sleep(INTERVAL);
          }
        } catch (InterruptedException e) {
          throw new AssertionError(e);
        }
      }
    };

    test.setDaemon(true);
    test.start();

    localSet.await();

    assertEquals("hello", unsafeThreadLocal.get(test));
    assertEquals(null, unsafeThreadLocal.get(Thread.currentThread()));
  }
Test that we can get the value of a thread local from another thread.
geode-core/src/test/java/org/apache/geode/distributed/internal/deadlock/UnsafeThreadLocalJUnitTest.java