public final class ContextPropagationAsyncHandler extends Object
| Constructor and Description |
|---|
ContextPropagationAsyncHandler() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
tryHandleAsynchronously(TransactionManager tm,
Transaction tx,
Transactional transactional,
AtomicReference objectToHandleRef,
Class<?> returnType,
RunnableWithException afterEndTransaction)
Tries to handle asynchronously the returned type from the @
Transactional call. |
public static boolean tryHandleAsynchronously(TransactionManager tm, Transaction tx, Transactional transactional, AtomicReference objectToHandleRef, Class<?> returnType, RunnableWithException afterEndTransaction) throws Exception
Tries to handle asynchronously the returned type from the @Transactional call.
This CDI interceptor method checks the return type intercepted method.
If it's a asynchronous "type" (objectToHandle is 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 @Transactional
ends.
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 finalizationException - failure on async processing error happensCopyright © 2020 JBoss by Red Hat. All rights reserved.