Closed luocunhao closed 1 month ago
@luocunhao
可以看看使用withInitialAndCopier(Supplier supplier, TtlCopier copierForChildValueAndCopy)
方法:
InheritableThreadLocal<Map<String, String>> logTagsLocal =
TransmittableThreadLocal.withInitialAndCopier(HashMap::new, HashMap::new);
PS:具体合适的解决方法与你需求相关。
更多说明参见已有issue:
子线程不是会对父线程的HashMap做一份快照拷贝吗,那么即使子线程有修改map也不会影响父线程访问才对