title: ThreadLocal safety in Weblogic threadpool
body: <p>I'm writing an app which uses MDBs, EJBs and needs ThreadLocal to pass and log a variable across multiple EJBs and Helper classes until the transaction is complete. </p>
  
  <p>The flow is</p>
  
  <p>Starting with MDB onMessage() 
  -> some business delegate EJBs
  -> some helpers</p>
  
  <p>Question:</p>
  
  <p>This app runs within Weblogic and Weblogic re-uses Threads from within it's ThreadPool. So is there a possibility of data corruption across threads? Is the solution to use <code>ThreadLocal.remove()</code> safe enough?</p>
  
  <p>Is there an alternative to ThreadLocal other than passing around the Object as a parameter to all methods?</p>