Is there a way to list TheadLocals bound to a thread? Ideally I could access the Thread.threadLocals map, but it is package protected.
The reason I need this is I need to inspect threads as they are returned to a thread pool to ensure the ThreadLocals have been properly cleaned up. Perhaps there is another way to do this?
Listing ThreadLocals and Clearing ThreadLocals can be accomplished by using reflection (and the setAccessible() flag) to override the JVM's usual permissions. For obvious reasons, this not available when all security mechanisms are in place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With