Package io.micronaut.transaction.support
Class AbstractPropagatedStatusTransactionOperations<T extends TransactionStatus<C>,C>
java.lang.Object
io.micronaut.transaction.support.AbstractPropagatedStatusTransactionOperations<T,C>
- Type Parameters:
T
- The transaction typeC
- The connection type
- All Implemented Interfaces:
TransactionOperations<C>
- Direct Known Subclasses:
AbstractSpringTransactionOperations
,AbstractTransactionOperations
public abstract class AbstractPropagatedStatusTransactionOperations<T extends TransactionStatus<C>,C>
extends Object
implements TransactionOperations<C>
Abstract transaction operations that propagates the status in the propagated context.
- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <R> R
doExecute
(TransactionDefinition definition, TransactionCallback<C, R> callback) Do execute in transaction.final <R> R
execute
(@NonNull TransactionDefinition definition, @NonNull TransactionCallback<C, R> callback) Execute a transaction within the context of the function.protected @NonNull io.micronaut.core.propagation.PropagatedContext
Extends the propagated context with the transaction status.Find optional propagated transaction status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.transaction.TransactionOperations
executeRead, executeWrite, getConnection, hasConnection
-
Constructor Details
-
AbstractPropagatedStatusTransactionOperations
public AbstractPropagatedStatusTransactionOperations()
-
-
Method Details
-
doExecute
protected abstract <R> R doExecute(TransactionDefinition definition, TransactionCallback<C, R> callback) Do execute in transaction.- Type Parameters:
R
- The result type- Parameters:
definition
- The transaction definitioncallback
- The callback- Returns:
- The result
-
findTransactionStatus
Description copied from interface:TransactionOperations
Find optional propagated transaction status.- Specified by:
findTransactionStatus
in interfaceTransactionOperations<T extends TransactionStatus<C>>
- Returns:
- The transaction status.
-
execute
public final <R> R execute(@NonNull @NonNull TransactionDefinition definition, @NonNull @NonNull TransactionCallback<C, R> callback) Description copied from interface:TransactionOperations
Execute a transaction within the context of the function.- Specified by:
execute
in interfaceTransactionOperations<T extends TransactionStatus<C>>
- Type Parameters:
R
- The result- Parameters:
definition
- The transaction definitioncallback
- The call back- Returns:
- The result
-
extendCurrentPropagatedContext
@NonNull protected @NonNull io.micronaut.core.propagation.PropagatedContext extendCurrentPropagatedContext(TransactionStatus<C> status) Extends the propagated context with the transaction status.- Parameters:
status
- The transaction status- Returns:
- new propagated context
-