title: How can an EJB parallelize a long, CPU intensive process?
body: <p>The application has a CPU intensive long process that currently runs on one server (an EJB method) serially when the client requests it.</p>
  
  <p>It’s theoretically possible (from a conceptual point of view) to split that process in N chunks and execute them in parallel, as long as the output of all parallel jobs can be collected and joined together before  sending it back to the client that initiated the process. I’d like to use this parallelization to optimize performance.</p>
  
  <p>How can I implement this parallelization with EJBs? I know that we should not create threads in a EJB method. Instead, we should publish messages (one per job) to be consumed by message driven beans (MDBs). But then it would not be a synchronous call anymore. And being synchronous seems to be a requirement in this case since I need to collect the output of all jobs before sending it back to the client.</p>
  
  <p>Is there a solution for this?</p>