Maybe I'm being dense here but:

If every session contains a reference to the bean, and every thread is
synchronizing on their own session;

It would seem that there would not be any concurrency control.

I would think that they all need to sync on the same object.

JC


                                                                                
                                        
                      "Kalra, Ashwani"                                          
                                        
                      <[EMAIL PROTECTED]        To:       "Struts (E-mail)" 
<user@struts.apache.org>                    
                      gemini.com>               cc:                             
                                        
                                                Subject:  concurrency problem   
                                        
                      04/08/2005 06:10                                          
                                        
                      AM                                                        
                                        
                      Please respond to                                         
                                        
                      "Struts Users                                             
                                        
                      Mailing List"                                             
                                        
                                                                                
                                        





I am facing concurrency problem in following scenario.


All our action classes call same stateful session bean .  Each action class
obtains the reference  from HTTPSession object and calls one and only one
business method.
To prevent the concurrent access to this instance which occurs when user
immediately presses two links quickly in succession I am using the
following code block




execute(...)  //execute methods of Action class
{
....
....


//Obtain the session from  Request.User will always be in session here
session=request.getSession()
Synchronised(session)
{
    //call ejb's  business method.
}


}


However sometimes  more than one thread is able to pass through, And I get
exception from Appserver. As 2 threads are not allowed for statefull
Session bean.
Can there be problem in above code. Is it ok to synchronise on session
object.









Thanks & Regds
 Ashwani

Ext: 1860









This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,  you
are not authorized to read, print, retain, copy, disseminate,  distribute,
or use this message or any part thereof. If you receive this  message in
error, please notify the sender immediately and delete all  copies of this
message.



------------------------------------------------------------------------------
**********
The information contained in this communication is confidential, private, 
proprietary, or otherwise privileged and is intended only for the use of the 
addressee.  Unauthorized use, disclosure, distribution or copying is strictly 
prohibited and may be unlawful.  If you have received this communication in 
error, please notify the sender immediately at (312)653-6000 in Illinois; 
(972)766-6900 in Texas; or (800)835-8699 in New Mexico.
**********
==============================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to