A meta-note - this work may well end up in another spec (i.e. JTA) but lets work on here
for now, until we sort out it's correct home.
On 24 Oct 2011, at 19:32, Rick Hightower wrote:
TODO There are six standard scopes... (not five)
TODO (Then list @TransactionScope as one of those scopes.)
Section 6.7.8 Transaction Context Lifecycle
This should work with various types of transaction management systems, but it is defined
in terms of JTA for ease of documentation by associating it with a known, specified JSR
The transaction context is provided by a built-in context object for the built-in scope
type @TransactionScoped. The transaction scope is active when TransactionManager.begin is
called (when the status goes to active), and ends when TransactionManager.commit or
TransactionManager.rollback is called.
The transaction context is shared between all beans involved in the transaction. The
transaction context is destroyed when transaction is rolledback, or committed.
An event with the TransactionEvent as payload and with qualifier
@Initialized(TransactionScoped.class) is fired when the transaction context is initialized
and moved to the active state and an event with qualifier
@Destroyed(TransactionScoped.class) when the transaction context is destroyed.
Design Notes: CDI transaction context could work with JTA by registering with a
Synchronization callback with the Transaction object in JTA. Then CDI will listen for the
STATUS_ACTIVE state to indicate a transaction is active, STATUS_ROLLEDBACK to be notified
of a rollback and lastly STATUS_COMMITTED to be notified of a commit. The contextual
instances will be stored directly or indirectly in the TransactionSynchronizationRegistry
when STATUS_ACTIVE is handled, and removed when the STATUS_ROLLEDBACK or STATUS_COMMITTED
If a transaction is suspended, the transactional scoped data is not impacted. It is only
the transaction active status or its final state of committed or rolledback that impacts
the lifecycle of the CDI transaction context.
cdi-dev mailing list