title: Thread local returning null intermittently
body: <p>I am using <code>ThreadLocal</code> to store a context variable. My component is a SOA - rest component. Problem is the <code>threadLocal</code> is that it is returning <code>null</code> intermittently. I am sure that I populate it before I use it. I am clearing it from a JAX-RS repsonse filter. </p>
  
  <p>Can the <code>static final</code> modifiers lead to this problem? And just by specifying it as a <code>InheritableThreadLocal</code> is the <code>threadLocal</code> available to all the child threads? </p>
  
  <pre><code>import java.util.Map;
  
  /**
   * Contains the context object and 
   */
  public class ContextHolder {
  
      private static final ThreadLocal&lt;Map&lt;String, Object&gt;&gt; threadLocal = new InheritableThreadLocal&lt;Map&lt;String, Object&gt;&gt;();
  
      /**
       * Private constructor so that nobody can create an instance.
       */
      private ContextHolder() {
      }
  
      /**
       * Initializes the threadlocal with the passed map.
       * 
       * @param context - 
       */
      public static void initConext(Map&lt;String, Object&gt; context) {
          threadLocal.set(context);
      }
  
      /**
       * Returns the context from this thread.
       * 
       * @return Context
       */
      public static Map&lt;String, Object&gt; getContext() {
          return threadLocal.get();
      }
  
      /**
       * Clears the context from the threadlocal.
       */
      public static void clearConext() {
          threadLocal.remove();
      }
  
  }
  </code></pre>