[cdi-dev] API for dispatching of async events

Martin Fryč martin at fryc.eu
Sun Mar 15 06:21:52 EDT 2015

Hi all,

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?
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:

ValidateTransactionDataEvent observed by more that one "application module"
    LimitVerification module
    AccessVerification module

LogTransactionEvent observed by some other modules
    TechnicalLog module (could be blocked in IO)

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 "stop"

If threre will be some policy API like:

java.util.concurrent.ExecutorService dispatch(T event, Annotation...

it will allow application to decide which thread pool should be used for
which type of event.
In EE environment, it must be ManagedExecutorService looked it up from
JNDI, in SE environment it could be ExecutorService created for
applications needs.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150315/9108df94/attachment.html 

More information about the cdi-dev mailing list