Results 1 to 3 of 3

Thread: ThreadLocal or InheritableThreadLocal

  1. #1
    Join Date
    Mar 2005
    Location
    Sterling, VA USA
    Posts
    34

    Default 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.
    http://forum.springframework.org/vie...ht=threadlocal

    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. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    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. #3
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

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

Similar Threads

  1. Replies: 7
    Last Post: Feb 9th, 2006, 09:30 PM
  2. Replies: 12
    Last Post: Sep 18th, 2005, 08:09 AM
  3. Replies: 0
    Last Post: Sep 12th, 2005, 01:48 PM
  4. Replies: 1
    Last Post: Jan 19th, 2005, 03:07 PM
  5. Replies: 2
    Last Post: Nov 27th, 2004, 06:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •