ThreadLocal instance getting null at some cases <p>Getting ThreadLocal instance as null. Using the following code, I had created new ThreadLocal instance.</p> <pre><code>private static final ThreadLocal&lt;SimpleDateFormat&gt; inputSdfLocal = new ThreadLocal&lt;SimpleDateFormat&gt;() { protected SimpleDateFormat initialValue() { return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); }; }; </code></pre> <p>Now I am calling ThreadLocal (inputSdfLocal) instance as inputSdfLocal.get().</p> <pre><code>SimpleDateFormat inputSdf = inputSdfLocal.get(); </code></pre> <p>At this point some time, I am getting ThreadLocal ->inputSdfLocal instance as null. Will anyone please explain, why ThreadLocal instance getting null.</p>