Package com.arjuna.ats.jta.cdi.async
Class ContextPropagationAsyncHandler
- java.lang.Object
-
- com.arjuna.ats.jta.cdi.async.ContextPropagationAsyncHandler
-
public final class ContextPropagationAsyncHandler extends java.lang.ObjectHandling asynchronous context propagation calls. It extends transactions until the intercepted method's async return type is completed.
-
-
Constructor Summary
Constructors Constructor Description ContextPropagationAsyncHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleantryHandleAsynchronously(javax.transaction.TransactionManager tm, javax.transaction.Transaction tx, javax.transaction.Transactional transactional, java.util.concurrent.atomic.AtomicReference objectToHandleRef, java.lang.Class<?> returnType, RunnableWithException afterEndTransaction)Tries to handle asynchronously the returned type from the @Transactionalcall.
-
-
-
Method Detail
-
tryHandleAsynchronously
public static boolean tryHandleAsynchronously(javax.transaction.TransactionManager tm, javax.transaction.Transaction tx, javax.transaction.Transactional transactional, java.util.concurrent.atomic.AtomicReference objectToHandleRef, java.lang.Class<?> returnType, RunnableWithException afterEndTransaction) throws java.lang.ExceptionTries to handle asynchronously the returned type from the @
Transactionalcall. This CDI interceptor method checks the return type intercepted method. If it's a asynchronous "type" (objectToHandleisinstanceof e.g. CompletionStage) then the transaction completion (committing/roll-backing) will be suspended until the asynchronous code finishes.If the interceptor returns nothing or just some "normal" return type then synchronous handling is processed. Synchronous means that the transaction is completed just here when the method annotated with @
Transactionalends.- Parameters:
tm- transaction managertx- the original transactiontransactional- link to method which is annotated with @TransactionalobjectToHandleRef- on interceptor proceed this is the returned type which differentiate the action; method changes the object when it was handled asynchronouslyreturnType-afterEndTransaction- a lamda invocation on transaction finalization- Returns:
- Throws:
java.lang.Exception- failure on async processing error happens
-
-