<div dir="ltr"><div>Hi all,</div><div><br></div><div>Is it possible to have some API for applications to provide policy which will decide which thread pool will be used for which type of events?</div><div>If all events share only one thread pool dedicated to processing of all async event, usage of this type of events is very limited. For example:</div><div><br></div><div>ValidateTransactionDataEvent observed by more that one &quot;application module&quot;</div><div>    LimitVerification module</div><div>    AccessVerification module</div><div>    ...</div><div><br></div><div>LogTransactionEvent observed by some other modules</div><div>    TechnicalLog module (could be blocked in IO)</div><div><br></div><div>If async events will be processed in similar way as async EJB methods - usually implemented in app servers as one shared thread pool with limited application control (discard policy, ...), both of these events will share one thread pool and some type of events could fully blocked it and &quot;stop&quot; application.</div><div><br></div><div>If threre will be some policy API like:</div><div><br></div><div>java.util.concurrent.ExecutorService dispatch(T event, Annotation... qualifiers)</div><div><br></div><div>it will allow application to decide which thread pool should be used for which type of event.</div><div>In EE environment, it must be ManagedExecutorService looked it up from JNDI, in SE environment it could be ExecutorService created for applications needs.</div><div><br></div><div>Martin</div></div>