Assaf Arkin 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?!

Cheers,
Laird

===========================================================================
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".

Reply via email to