Our application is launching a series of threads via the @Asynchronous annotation on EJBs. However, JBoss (contrairy to this) is not limiting the number of threads launched. Debugging shows that it is using a default class rather than the one configured in the XML linked in the issue above. The comment on the class says:
Static singleton access to a default java.util.concurrent.ExecutorService
implementation used by clients who do not supply a
org.jboss.ejb3.async.spi.AsyncInvocation to handle asynchronous
EJB 3.1 invocations.
So the question is under what circumstances is JBoss not supplying an org.jboss.ejb3.async.spi.AsyncInvocation class and how can you ensure that this does happen?
JBoss AS 6.1 should indeed limit the number of threads by default, but due to a bug this simply does not happen. The global setting is sadly ignored without warning.
If it doesn’t concern too many beans, you can use the
org.jboss.ejb3.annotation.Poolannotation:Be careful though, if I’m not mistaken this will create a pool per bean.