threadlocal
ThreadLocal public class RawRunnableTest { @Test public void testRawInheritableThreadLocal() throws InterruptedException { final ThreadLocal<Span> threadLocal = new ThreadLocal<>(); threadLocal.set(new Span("xiexiexie")); //输出 xiexiexie Object o = threadLocal.get(); Runnable runnable = new Runnable() { @Override public void run() { System.out.println(threadLocal.get() + "thead-" + Thread.currentThread()); threadLocal.set(new Span("zhangzhangzhang1")); System.out.println(threadLocal.get() + "thead-" + Thread.currentThread()); } }; Runnable runnable2 = new Runnable() { @Override public void run() { System.out.println(threadLocal.get() + "thead-" + Thread.currentThread()); threadLocal.set(new Span("zhangzhangzhang2")); System.
[Read More]