EJB's and Threading

前端 未结 4 911
醉话见心
醉话见心 2021-02-06 08:55

From what I understand it is illegal to spawn threads from within an EJB as it may potentially interfere with the EJB\'s lifecycle. However, is it illegal to use predefined Java

4条回答
  •  长发绾君心
    2021-02-06 09:12

    This is what EJB 3.1 @Asynchronous is for and definitely should be used instead of an Executor. It's generally very dangerous to compete with the container's thread pools. Doing so is a great way to kill performance.

    The Asynchronous support will use the container's thread pools and be far safer. See this answer for details on how Asynchronous works.

提交回复
热议问题