You'd be better off implementing token processing.

Struts includes token generation and helper methods to ensure only one valid request is handled at a time. Look at the struts example application (mailreader) for an example.

For detailed info on why this pattern works, see:
http://www.amazon.com/exec/obidos/tg/detail/-/0201634988/ref=lpr_g_1/102-8250064-5792120?v=glance&s=books




-- James Mitchell Software Engineer / Open Source Evangelist Consulting / Mentoring / Freelance EdgeTech, Inc. 678.910.8017 AIM: jmitchtx Yahoo: jmitchtx MSN: [EMAIL PROTECTED]




----- Original Message ----- From: "Kalra, Ashwani" <[EMAIL PROTECTED]>
To: "Struts (E-mail)" <user@struts.apache.org>
Sent: Friday, April 08, 2005 7:10 AM
Subject: concurrency problem




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.



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



Reply via email to