先看下Thread的代码结构 public class Thread implements Runnable { //默认线程里存放的为空,维护的是当前线程关联的的ThreadLocal.ThreadLocalMap的值 ThreadLocal.ThreadLocalMap threadLocals = null; //线程退出时 private void exit() { //解除了线程和threadloca的关系 threadLocals = null; }} 再看下ThreadLocal的代码结构 publi…