1、父子线程结合线程池使用
阿里开源框架transmittable-thread-local
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>2.2.0</version>
</dependency>
static TransmittableThreadLocal<UrlThread> TTL = new TransmittableThreadLocal<>()
2、父子线程不适用线程池
public static InheritableThreadLocal<UrlThread> threadLocal = new InheritableThreadLocal<>();
因为InheritableThreadLocal插入数据的时机为new 线程是插入的,因此这个可以使用