[cdi-dev] CDI 2.0 EDR: Questions on asynchronous observers
Nigel Deakin
nigel.deakin at oracle.com
Tue Aug 11 11:33:18 EDT 2015
I've read section 10 "Events" of the CDI 2.0 early draft, and have a couple of quick questions about asynchronous
observers.
I'd like to understand how these work with transactions. (I'm referring to normal observer methods here, not the rather
specialised "transactional observer methods")
10.5 states "...An observer method may not directly initiate, commit or rollback JTA transactions."
This wording is unchanged from CDI 1.1. What is the reason for this restriction? I think it might be useful if an
observer method was able to use the JTA API to start and end a transaction, especially when the observer method is being
called asynchronously.
10.5.3 "If the observer method is asynchronous, it is called in... a new transaction context...".
What does "a new transaction context" mean? Does this mean that the container will start a transaction before calling
the observer method? If so, it would be useful if the application could disable this. If not, it would be useful if the
application could itself use the JTA API to start and end a transaction.
Nigel
More information about the cdi-dev
mailing list