
ThreadLcoal.get()会获取调用线程 的Entry的value。
public T get() {
Thread t = Thread.currentThread();
// 获取当前线程的localMap
ThreadLocalMap map = getMap(t);
if (map != null) {
// 获取Entry, 键key就是当前threadlocal对象
ThreadLocalMap.Entry e = map.getEntry(this);
if (e != null) {
@SuppressWarnings("unchecked")
T result = (T)e.value;
return result;
}
}
return setInitialValue();
}