[jboss-user] [Tomcat, HTTPD, Servlets & JSP] - Are RMI Stubs in JNDI Thread-safe?
micho
do-not-reply at jboss.com
Thu Dec 14 06:17:22 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 servlet.
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(); }
| }
|
If it is not allowed, is there a performant way to solve the problem, without creating an initialContext in every call of the servelet.
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=3993789#3993789
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993789
More information about the jboss-user
mailing list