in tomcat's thread-pool,When a thread is used to store some values and finally the request is end and the thread return to thread-pool,does the thread-local values reset or remove?
Asked
Active
Viewed 601 times
0
-
2What's the difference between resetting and removing? Why would it do either? And why are you asking? – shmosel Sep 20 '17 at 02:38
-
emmm,i mean remove. – MaoYuChun Sep 20 '17 at 04:21
-
This is a duplicate of https://stackoverflow.com/questions/30328437/will-the-threadlocal-object-be-cleared-after-thread-returned-to-thread-pool – CodesInTheDark Jan 11 '18 at 00:15
1 Answers
1
No, the values are not removed because you might want to use the same threadLocal value next time when your request get that thread from the pool.
If you are concerned about memory leaks then this might help you: https://wiki.apache.org/tomcat/MemoryLeakProtection

CodesInTheDark
- 151
- 1
- 9