users@glassfish.java.net

Re: Register stateful session bean EJB in JNDI during runtime

From: <glassfish_at_javadesktop.org>
Date: Mon, 25 Jun 2007 08:17:07 PDT

Once a particular component has acquired a reference to a stateful session bean, there is nothing
preventing it from making that reference available to some other piece of code. E.g, by placing
it within the ServletContext or HttpSession, or even in the case that it's a Remote reference,
passing it as a parameter or return value of a remote business method.

Note that making the reference available to a different piece of code is independent of the
sharing issue. Each stateful session bean is still only intended to be accessed by a single
client at a time.

Registering it within JNDI is also a separate issue. There is no portable, mutable, global
JNDI namespace in Java EE. From the component's perspective there is only a read-only
private component namespace. For that reason, there is no portable way for the component
to dynamically register a stateful session bean reference (or any other object for that matter)
in a global namespace at runtime.

A related issue is that there is a slightly different often requested use-case for singleton
support in EJB, which would allow state that *is* intended to be shared to be more easily
within the ejb and web components in an application. That's a feature we are seriously
considering for the next version of EJB.

 --ken
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=223791