I have two tasks that I need to complete: task1 and task2 , which are part of the same business process. I have to give an answer to the end user when task1 completes, so the response time should be kept to a minimum.
My current approach is to execute task1 and once task1 is complete call the task2 method asynchronously. task2 is complex, and the response time is out of my control, as it has some external dependency.
@Stateless public class SessionBean1 { @Inject SessionBean2 sessionBean2; public void doTask1(){
In websphere 8.0 (the EJB container used), synchronous methods and asynchronous methods are executed by different thread pools.
My initial assumption was that even if task2 does not work well, task1 will not be affected, but unfortunately this is not the case.
If task2 does not work well, all threads from the asynchronous thread pool will be busy. This will cause task1 expect asynchronous threads to be free, and therefore task1 has an effect.
Websphrere server logs: The request buffer for thread pool WorkManager.WebSphere_EJB_Container_AsynchMethods_Internal_WorkManager has reached its capacity
My question is what would be the right way to achieve what I am trying to achieve here.
source share