Hi Laurent,

Regarding the out of synch for objects stored in the servlet session, this
is of course only interesting for Entity EJB's.
The problem is related to the transaction scope, if the Entity EJB is
outside the transaction in which it was retrieved then each call will
result in a call to the datasource, where as within the same transaction it
will use the data loaded from the datasource (This is the case for IBM
WebSphere and I also think it is valid for BEA).

The following is valid for IBM WebSphere, I don't know if it is the same
for BEA.
The problem with the SessionBean is that the EJB container contains a pool
of SessionBeans.
For stateless SessionBeans the a free SessionBean is used from the pool for
each method call and when the method has finished the SessionBean is
returned to the pool.
For statefull SessionBeans then SessionBean the is taken from the pool when
created (requested) and first returned to the pool when it is released. So
if you reuse a statefull SessionBean through the servlet session then the
EJB container have to reserve a object for each session. Now assume that
the servlet session has an expiry of one hour and you have a 10000 users an
hour then the EJB container have to have atleasd 10000 instances of the
statefull SessionBean. The idea with statefull SessionBean is not that the
state can be reused over a longer period (it is possible), but it makes it
possible to sequentially call a sessionbean that keeps track of previous
calls. It is possible to resue the transaction across calls to the
statefull SessionBean, and still the statefull SessionBean should only be
keept in a short period of time.

Regards

Morten Jul Nielsen
----------------------------------------------------------------------
Advisory IT-Specialist, Master of Science in Engineering - Informatics
Mobile e-business Practice
Business Innovation Services, IBM Global Services
Sortemosevej 21 - E1C, DK-3450 Allerød, Denmark
Phone: + 45 45239517,   Mobil : +45 23236116   Fax:       +45 45236805


                                                                                       
                             
                    Laurent                                                            
                             
                    Letellier             To:     "'[EMAIL PROTECTED]'" 
<[EMAIL PROTECTED]>           
                    <l.letellier@fr       cc:                                          
                             
                    ontoo.com>            Subject:     RE: Session Tracking question. 
--> Use og EJB                
                                                                                       
                             
                    10-08-2001                                                         
                             
                    11:03                                                              
                             
                    Please respond                                                     
                             
                    to soap-user                                                       
                             
                                                                                       
                             
                                                                                       
                             



Hi Morten,

Could you explain why/how the EJB could get out of synch if it is stored in
the http session object?

The thing is I had seen people do it the way you describe it but I didn't
understand why. So I stored in the http session an object which has a
reference to the statefull session bean and I'm afraid the problem you're
talking about could happen.

Thanks,

Laurent



-----Message d'origine-----
De : Morten J Nielsen [mailto:[EMAIL PROTECTED]]
Envoyé : vendredi 10 août 2001 10:35
À : [EMAIL PROTECTED]
Objet : RE: Session Tracking question. --> Use og EJB



Hi Venkat,

Just a question about your use of EJB.

Am I right if I understood that you have a servlet for authentication which
stores a EJB in the servlet session object?

If this is the case then you may run into problems.

As a good guideline don't store complexe objects in the servlet session
object like an EJB. Regarding the EJB, then it may get out of synch with
the datasource.
Solution: if you only need one or two fields then copy them into an other
object stored in the session object, else store the key used to retrieve
the EJB afterwards and thrust the EJB container to catch the EJB for
performance (If you are using IBM WebSphere then this is no problem).

An other problem is that it sounds like you are using statefull session
beans which is considerably low on performance compared to stateless
session beans. Solution: Change your session beans to be stateless, then
you don't need to store a reference to the EJB.

My sugestion to you is that you store a userid in the servlet session
object, and when you call the SOAP service you include the userid in the
request. Though your business method will be able to retrieve the user
object and save the work.

Ragards

Morten Jul Nielsen
----------------------------------------------------------------------
Advisory IT-Specialist, Master of Science in Engineering - Informatics
Mobile e-business Practice
Business Innovation Services, IBM Global Services
Sortemosevej 21 - E1C, DK-3450 Allerød, Denmark
Phone: + 45 45239517,   Mobil : +45 23236116   Fax:       +45 45236805




                    venkat reddy

                    <venkatr@Gandi       To:
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
                    va.com>              cc:

                                         Subject:     RE: Session Tracking
question.
                    01-08-2001

                    17:20

                    Please respond

                    to soap-user








Hi,
           How can we restrict the client to use the same 'Call' Object
over
and over for invoking different SOAP services that are deployed on a web
server? Is it by resetting the targetObjectURI and the method & parameters
of that 'Call' Object? If this is the case then it is limitation to what
SOAP can do under session scope. This means that the 'Call' Object is tied
to the SOAP Service that is of scope 'session' and not the client itself.
Well any ways this is not my problem child. My problem is something like
this.
           When a User logs in, a Servlet handles the authentication and
creates and EJB Object that is stored in the session object for that user.
I
need to access and invoke a business method on this EJB object some time
later when the user decides to save his work to the database. My question
is
how do I get the handle to this EJB Object, that is stored in the session
object, from my SAOP Service. Is there any way to access the session object
that was originally created by the servlet during user authentication from
a
SOAP Service?

Christian -- Thanks for the reply.

~Venkat







Reply via email to