How to synchronize the request for same session?

Skip to first unread message

Tushar Patel

Oct 22, 2014, 2:21:16 AM10/22/14
We have all our business logic written as Stateful EJB component. This doesn't allow concurrent access. So If I have concurrent AJAX call through UI then it throws the Runtime Exception. This exception causes EJB to be removed which leaves the stale reference in session.

We want to queue (synchronized) the request if it is for the same session to avoid the issue. So my question is What is the best way to synchronize the request of same session? Should I just make HttpDispatcher.dispatchRequest() method synchronized?


Adinath Raveendra Raj

Nov 3, 2014, 1:41:51 AM11/3/14

I would not recommend making the entire method synchronized, since this would *severely* restrict containers ability to process web requests. Consider using a synchronization block that is specific to the session or better yet to the specific application module instance with the issue. Also, as far as I know concurrently accessing an EJB does not cause it to die, what is likely happening is a nested EJB call, and the nested call is throwing a concurrent access exception (a runtime exception) which if not handled by the caller will call the calling EJB to die.

Hope this helps.


You received this message because you are subscribed to the Google Groups "Induction Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages