A simple prototype (work in progress, no optimizations, etc.) is here: https://github.com/mkouba/core/tree/WELD-1728
Observations:
-
@javax.annotation.Priority target would have to be updated, it's @Target(TYPE) atm
-
the spec would have to define a way to specify priority for custom observers
-
this prorotype defines an optional interface org.jboss.weld.experimental.Prioritized
-
observer methods without @Priority are called after prioritized observers, other possibility would be to set the default priority to some predefined constant a la javax.interceptor.Interceptor.Priority.APPLICATION
-
transactional observers notifications are "grouped" into single JTA synchronization
-
note that there are three possible "ordered batches" of deffered notifications:
-
BEFORE_COMPLETION (if we try to commit the tx)
-
AFTER_COMPLETION + AFTER_FAILURE (if tx rolled back)
-
AFTER_COMPLETION + AFTER_SUCCESS (if tx commited)
-
see also org.jboss.weld.event.TransactionNotificationSynchronization
|