How can an EJB parallelize a long, CPU intensive process?

前端 未结 6 763
礼貌的吻别
礼貌的吻别 2020-12-05 11:51

The application has a CPU intensive long process that currently runs on one server (an EJB method) serially when the client requests it.

It’s theoretically possible

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 12:29

    This particular question has come up on multiple occasions and I will summarize that there are several possible solutions, only 1 of which I would recommend.

    Use a WorkManager from the commonj API. It allows for managed threads in a Java EE container and is specifically designed to fit your use case. If you are using WebSphere or WebLogic, these API's are already available in your server. For others your will have to put a third party solution in yourself.

    WorkManager info

    Related questions Why Spawning threads is discouraged

提交回复
热议问题