Class CoroutineTxHelper
java.lang.Object
io.micronaut.transaction.interceptor.CoroutineTxHelper
@Internal
@Singleton
@Requires(classes=kotlin.coroutines.CoroutineContext.class)
public final class CoroutineTxHelper
extends Object
Helper to setup Kotlin coroutine context.
- Since:
- 3.3
- Author:
- Denis Stepanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetTxState
(io.micronaut.aop.kotlin.KotlinInterceptedMethod kotlinInterceptedMethod) Find the TX state.void
setupTxState
(io.micronaut.aop.kotlin.KotlinInterceptedMethod kotlinInterceptedMethod, TransactionSynchronizationManager.TransactionSynchronizationState state) Extract the TX state from the Kotlin's context or takes the thread-local context.
-
Constructor Details
-
CoroutineTxHelper
public CoroutineTxHelper()
-
-
Method Details
-
setupTxState
public void setupTxState(io.micronaut.aop.kotlin.KotlinInterceptedMethod kotlinInterceptedMethod, TransactionSynchronizationManager.TransactionSynchronizationState state) Extract the TX state from the Kotlin's context or takes the thread-local context.- Parameters:
state
- The transaction statekotlinInterceptedMethod
- The intercepted method
-
getTxState
@Nullable public TransactionSynchronizationManager.TransactionSynchronizationState getTxState(@NonNull io.micronaut.aop.kotlin.KotlinInterceptedMethod kotlinInterceptedMethod) Find the TX state.- Parameters:
kotlinInterceptedMethod
- The intercepted method- Returns:
- the state
-