Top Description Inners Constructors Methods
org.springframework.transaction.reactive

public abstract Class TransactionContextManager

extends Object
Class Inheritance
Imports
java.util.ArrayDeque, java.util.function.Function, reactor.core.publisher.Flux, .Mono, reactor.util.context.Context, org.springframework.transaction.NoTransactionException

Delegate to register and obtain transactional contexts.

Typically used by components that intercept or orchestrate transactional flows such as AOP interceptors or transactional operators.

Author
Mark Paluch
Since
5.2
See Also
TransactionSynchronization

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Function<Context, Context>

Returns:

functional context registration.
createTransactionContext
()

Create a TransactionContext and register it in the subscriber Context.

public static Mono<TransactionContext>

Returns:

the current TransactionContext
currentContext
()

Obtain the current TransactionContext from the subscriber context or the transactional context holder.

public static Function<Context, Context>

Returns:

functional context registration.
getOrCreateContext
()

Return a Function to create or associate a new TransactionContext.

public static Function<Context, Context>

Returns:

functional context registration.
getOrCreateContextHolder
()

Return a Function to create or associate a new TransactionContextHolder.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TransactionContextManagerback to summary
private TransactionContextManager()

Method Detail

createTransactionContextback to summary
public static Function<Context, Context> createTransactionContext()

Create a TransactionContext and register it in the subscriber Context.

Returns:Function<Context, Context>

functional context registration.

Exceptions
IllegalStateException:
if a transaction context is already associated.
See Also
Mono#contextWrite(Function), Flux#contextWrite(Function)
currentContextback to summary
public static Mono<TransactionContext> currentContext()

Obtain the current TransactionContext from the subscriber context or the transactional context holder. Context retrieval fails with NoTransactionException if no context or context holder is registered.

Returns:Mono<TransactionContext>

the current TransactionContext

Exceptions
NoTransactionException:
if no TransactionContext was found in the subscriber context or no context found in a holder
getOrCreateContextback to summary
public static Function<Context, Context> getOrCreateContext()

Return a Function to create or associate a new TransactionContext. Interaction with transactional resources through TransactionSynchronizationManager requires a TransactionContext to be registered in the subscriber context.

Returns:Function<Context, Context>

functional context registration.

getOrCreateContextHolderback to summary
public static Function<Context, Context> getOrCreateContextHolder()

Return a Function to create or associate a new TransactionContextHolder. Creation and release of transactions within a reactive flow requires a mutable holder that follows a top to down execution scheme. Reactor's subscriber context follows a down to top approach regarding mutation visibility.

Returns:Function<Context, Context>

functional context registration.

org.springframework.transaction.reactive back to summary

private Class TransactionContextManager.NoTransactionInContextException

extends NoTransactionException
Class Inheritance
Annotations
@SuppressWarnings:serial

Stackless variant of NoTransactionException for reactive flows.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized Throwable
fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace.

Constructor Detail

NoTransactionInContextExceptionback to summary
public NoTransactionInContextException()

Method Detail

fillInStackTraceback to summary
public synchronized Throwable fillInStackTrace()

Overrides java.lang.Throwable.fillInStackTrace.

Doc from java.lang.Throwable.fillInStackTrace.

Fills in the execution stack trace. This method records within this Throwable object information about the current state of the stack frames for the current thread.

If the stack trace of this Throwable is not writable, calling this method has no effect.

Returns:Throwable

a reference to this Throwable instance.

Annotations
@Override