Hi David
What I got from ur mail is --- u do a sessionhome.create() everytime u try
to use the stateless session beans service and the reson u do it is -- u
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 (it is a stateless session bean -- so no problem of
state here!)??
TIA
Ana
-----Original Message-----
From: david sims [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 18, 2000 11:42 AM
To: [EMAIL PROTECTED]
Subject: Re: HttpSession versus EJB Session Bean
On Tue, 18 Apr 2000, Tim Endres wrote:
> One of the things that David Sims discovered was that his EJB server was
> keying "identity" off of the thread. Thus, an existing Session bean, when
> referenced by a second servlet hit in a new thread, was dropping the role
> and principal that had been established by the first servlet hit.
correct.
> So, I believe the approach that David took was to store the user's name
> and role in the servlet session, and use this with each hit for the
> InitialContext call. I do not know if he has any stateful SBs behind
> this part or not.
No, I have no stateful session beans. What I did, actually, was store the
user's name and password in the servlet session (NOT in a cookie). Then
everytime the user clicks something on the web page, I use the
username/password to create a brand new InitialContext, then create a brand
new
stateless session bean. Then perform the requested operation through the new
stateless session bean.
I always create new stateless session beans in this manner because I don't
know
how long it has been since the user last did something. I don't know if my
previous stateless session bean has timed out. So, for simplicity, I always
create a new one. I don't want to write "retry" code when the simpler
solution
is very fast, as it is in this case.
This is a very fast operation for me and my setup. Servlets in one JVM, EJB
container in another JVM, both JVMs on the same box.
> I would like to know if any other EJB servers use this approach of tying
> "identity" to the thread.
me too!
cheers,
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".
===========================================================================
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".