Closed xxd137494375 closed 1 year ago
@xxd137494375 好问题~ 👍 TTL
的 issue 请重新提到: 💕
https://github.com/alibaba/transmittable-thread-local/issues
PS: 问一下,为什么你会提这个库里来?(或说怎么导航到这个库来的)
https://github.com/sanbit/transmittable-thread-local/blob/master/README-EN.md 从这个链接里点进来的。。。
好的。
我再确认了一下:目前TTL
官方库中没有了;之前有链接错误的,已修正。
到 https://github.com/alibaba/transmittable-thread-local/issues 再提一下吧~
this issue is moved to https://github.com/alibaba/transmittable-thread-local/issues/528
在看2.14.2版本的源码中,发现registerThreadLocal函数在处理threadLocalHolder并发修改问题时,即加了锁,又使用了copy on write思想。对于这里有个疑问,加了锁,已经保证了线程安全,为何还要使用copy on write? 是在考虑什么隐藏问题吗?
public static boolean registerThreadLocal(@NonNull ThreadLocal threadLocal, @NonNull TtlCopier copier, boolean force) {
if (threadLocal instanceof TransmittableThreadLocal) {
logger.warning("register a TransmittableThreadLocal instance, this is unnecessary!");
return true;
}