Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
6.0.0-beta1
-
None
Description
Actually, I only checked 6.0.0-beta2 and master, 6.0.0-beta2 is not in the drop down.
ThreadLocal.get() returns the current value, if one is set. If not, it creates a new value using the initialValue() method, AND (importantly) registers the ThreadLocal in the Thread's Map of ThreadLocals.
In order for the get(false) method to work as expected, we must actually call ThreadLocal.remove() after a ThreadLocal.get() that returned null.
Also, after the request was processed, we never properly remove the ThreadLocal from the Thread, we were simply setting it to the previous value, which was null most of the time. This is not enough. The ThreadLocal was still attached to the Thread, just the value it was storing was null.
Here's hoping that Jira is working again and I can attach a patch.