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