title: Is javax.naming.InitialContext ThreadSafe
body: <p>Currently I am use following code to lookup EJB3 sateless session beans for normal POJO class. (We are in JEE5 so we can not inject Stateless Session Beans in normal POJO class I have to use look up) </p>
  
  <pre><code>import javax.naming.Context;  
  import javax.naming.InitialContext;  
  import javax.naming.NamingException;  
  
  import org.apache.log4j.Logger;  
  
  public Object getEJB(String jndiName) {  
  
                  logger.debug("WEBSPHERE EJB Lookup : " + jndiName);  
                  String modifiedJndiName = "";  
                  Hashtable&lt;Object, Object&gt; properties = new Hashtable&lt;Object, Object&gt;();  
                  properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");  
                  properties.put(Context.PROVIDER_URL, "iiop://localhost:2809");  
                  try {  
                      Context context = new InitialContext(properties);  
                      logger.debug("WEBSPHERE EJB Lookup Modified JNDI Name: " + modifiedJndiName);  
                      return context.lookup("ejblocal:"+modifiedJndiName);  
                  }catch (NamingException ne) {  
                      logger.debug("Naming Exception occurred :"+jndiName +"&gt;&gt;&gt;"+ne.getMessage());  
                      logger.error(ne.getMessage(), ne);  
                  }  
  
                  return null;  
              }  
  </code></pre>
  
  <p>So is Context object is ThredSafe? should I create Context object for each call [as shown in this code snippet] or I can reuse the Context for all threads? </p>