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
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.