[jboss-user] [EJB 3.0] - Are References to Sessionbeans threadsafe?

micho do-not-reply at jboss.com
Wed Nov 22 16:58:15 EST 2006


I have a servlet talking to a Sessionbean.

Is it allowed -regarding threadsafeness - to  obtain  the manager in the servlets init() method and store it in an instance-membervariable of the class.

public class LzServlet extends HttpServlet {
  | 
  |   MandantenManager mm =null;
  |   
  |   public void init(ServletConfig config)
  |   { 
  |     try
  |     { InitialContext ctx = new InitialContext();
  |       mm = (MandantenManager) ctx.lookup("BBCS/MandantenManagerBean/remote");
  |     }
  |     catch (Exception e)
  |     {
  |       e.printStackTrace();
  |       System.exit(-1);
  |     }
  |   }
  | 

Is getting the initialcontext and the lookup an "expensive" operation?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988002#3988002

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988002



More information about the jboss-user mailing list