Wicket
  1. Wicket
  2. WICKET-4574

ThreadContext does not properly remove the ThreadLocal from the current thread

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.0-beta1
    • Fix Version/s: 1.5.8, 6.0.0-beta3
    • Component/s: wicket
    • Labels:
      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.

        Activity

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Jesse Long
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development