Today, looking at the code of the open source project, I saw why a class called TransmittableThreadLocal put the object set into it!

Today, looking at the code of the open source project, I saw why a class called TransmittableThreadLocal put the object set in!
what is the purpose of this class? In what scenarios will
be used? What are the benefits of
?

Mar.24,2021

TransmittableThreadLocal this class is from an open source project of Ali: https://github.com/alibaba/tr.. The reason why this class appears is to solve the problem that when using cached thread components such as thread pool and Tomcat, such as ThreadPoolExecutor and tomcat thread pool, the data and ThreadLocal in one thread will be reused by the next Runable class or Http request without deletion or unbinding. When submitting a task to the thread pool, TransmittableThreadLocal submits the ThreadLocal data together when submitting the task to the thread pool to solve this problem, which is equivalent to re-set the ThreadLocal.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b1cd-2b5ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b1cd-2b5ce.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?