> Laird Nelson wrote:
> > > Assume that a stateless bean only exists for the duration of a method
> > > call. After you're done with it, the bean is disposed of (or reused by
> > > someone else). Before calling a bean, always look it up through JNDI.
> >
> > I think I understood this before, but its impact is just becoming clear
> > to me. Is it REALLY true that I *shouldn't* do something like this:
> >
> > // look up session bean here via JNDI...
> > sessionBean.foo();
> > sessionBean.bar();
> > sessionBean.baz();
> >
> > ...but SHOULD instead do something like this:
> >
> > InitialContext ctx = getTheContext(); // can't remember syntax off top
> > of head
> > SomeSessionBean bean = (SomeSessionBean)ctx.lookup(name);
> > bean.foo();
> >
> > bean = (SomeSessionBean)ctx.lookup(name);
> > bean.bar();
> >
> > bean = (SomeSessionBean)ctx.lookup(name);
> > bean.baz();
> >
> > ...? Wow. And this is all supposed to scale?!
Rickard �berg wrote:
> I think Assaf took it one step too far. You should hang on to the home
> object and do create/remove if you're in a clustered environment, since
> "many" implementations do loadbalancing on create() (a la COM).
The way we've read the EJB specification, a client which has obtained a
reference to a session bean (lookup + create) should be able to use that
very reference for at least the duration of the bean's session timeout.
After that time, it is probably "implementation defined" whether a new
reference must be obtained (by a new create or handle resolve) or whether
the original reference is still usable (and for how long).
Marc San Soucie
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".