Class AbstractPropagatedStatusTransactionOperations<T extends TransactionStatus<C>,C>

java.lang.Object
io.micronaut.transaction.support.AbstractPropagatedStatusTransactionOperations<T,C>
Type Parameters:
T - The transaction type
C - 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 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 definition
      callback - The callback
      Returns:
      The result
    • findTransactionStatus

      public final Optional<T> findTransactionStatus()
      Description copied from interface: TransactionOperations
      Find optional propagated transaction status.
      Specified by:
      findTransactionStatus in interface TransactionOperations<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 interface TransactionOperations<T extends TransactionStatus<C>>
      Type Parameters:
      R - The result
      Parameters:
      definition - The transaction definition
      callback - 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