You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kalra, Ashwani" <as...@capgemini.com> on 2005/04/11 08:59:00 UTC

[OT]RE: concurrency problem

hi,
Thanks all for your inputs. I need to ensure that sychronisation is should be happening on Unique object. I also have figured out the problem. I noticed  a second thread was calling another methods of the bean. Which is not synchronised.

Thanks again ..

Regds
Ashwani.

> -----Original Message-----
> From: Jeff_Caswell@bcbstx.com [mailto:Jeff_Caswell@bcbstx.com]
> Sent: Friday, April 08, 2005 8:22 PM
> To: Struts Users Mailing List
> Subject: Re: concurrency problem
>
>
>
>
>
>
> 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"                       
>                                                          
>                       <ashwani.kalra@cap        To:      
> "Struts (E-mail)" <us...@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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org