[cdi-dev] TransactionScope proposal

Pete Muir pmuir at redhat.com
Tue Oct 25 15:13:25 EDT 2011


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:

> Section 2.4.1.
> 
> 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 standard.
> 
> 
> 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 is handled.
> 
> 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.
> 
> -- 
> Rick Hightower
> (415) 968-9037 
> Profile 
> 
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev




More information about the cdi-dev mailing list