'Multithreaded EJB client

I would like to parallelize multiple ejb calls from a java client and maintain a single transaction. the ejb is exposed on an websphere application server, and the client is a simple spring boot war deployed on the same was. I'm able to maintain the transaction in an sequitial flow now i would like to parallelize this flow of calls. Is this possible?



Solution 1:[1]

WebSphere application server does not support a single transaction running concurrently on multiple threads. This is actively enforced; any attempt to parallelize your flow with a single transaction would result in an error.

If any of the EJB calls could run in a separate transaction, then you could parallelize their calls by marking the method with the @Asynchronous annotation (javax.ejb.Asynchronous). The return type would be Future, and the client could then wait for the EJB method(s) to complete if so desired.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tracy