On Tue, 18 Apr 2000, Bhattacharyya, Ana wrote:
> Hi David
> What I got from ur mail is --- u do a sessionhome.create() everytime u try
> to use the stateless session beans service

Not exactly. At the top of a servlet, yes, I create (a) a brand new
InitialContext and (b) a new stateless session bean. I do (a) because my
particular EJB container can't identify my caller because it's in a
different thread. I do (b) because I don't want to recover from a stateless
session bean that may have timed out. In the middle of the servlet, though, I
simply reuse the stateless session bean that I created at the top.

True, we'd like to think that stateless session beans don't "timeout". That
makes sense to me. After searching through the spec, though, I can't find
anything that specifically says that stateless session beans never timeout. I
can only find paragraphs that say, essentially, "session beans may timeout". It
doesn't specifically say, "only stateful session beans may timeout".

> really dont know whether ur session bean has been timed out or not.
> Now my question is what happens if the session has timed out and the client
> still has that session handle and tries to invoke a method. Will the
> container throw an exception or will it just create a session bean and
> redirect the call to it

I haven't run any tests on my EJB container lately. In general, though, when
session beans timeout and a client invokes one, you get a RemoteException
thrown back. On the face of it, it sounds reasonable that a new stateless
session bean would be created and no exception thrown. I just don't think I can
rely on this behavior. And besides, for me, creating new InitialContexts and
new stateless session beans is certainly not the bottleneck in my system.

Finally, it's a nice little recovery mechanism when I restart my EJB container
and don't have to restart my servlet container.

hope that helps.

I'd love to hear more comments from folks who know more about this. Also about
the "thread/caller identity" issue. How do other containers identify callers?
By thread? By the mere posession of an InitialContext?

regards,
david

--
David Sims               [EMAIL PROTECTED]
Sims Computing, Inc.       www.simscomputing.com

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