Announcement Announcement Module
No announcement yet.
ThreadLocal or InheritableThreadLocal Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ThreadLocal or InheritableThreadLocal

    I have a cases in my application where I need to access the context information in a new thread.

    There is one related posting on this group that describes one way of acheiving this.

    I am wondering if InheritableThreadLocal is also a possible solution? Was there a specific reason to use ThreadLocal instead of InheritableThreadLocal? If no, is it possible to change it to InheritableThreadLocal in the next versions? If so, how could it effect the existing single-threaded applications? It should not.

    Any comments?

  • #2
    We'll be refactoring ThreadLocal handling in 0.9.0 following suggestions from Juergen, so we'll change to InheritableThreadLocal at the same time. ThreadLocal was used initially as we were providing a general-purpose Context holder, and the thread inheritence semantics were unclear in such situations. As the refactorings will use a SecurityContext, it makes InheritableThreadLocal more appropriate.


    • #3
      I've just performed the aforementioned refactorings, and IheritableThreadLocal has been used instead of ThreadLocal.