Package org.axonframework.common.tx
Interface MaterializationAware
- All Known Implementing Classes:
ConnectionExecutor,EntityManagerExecutor
Optionally implemented by a
can prefer an independently-managed
resource over forcing this one to materialize - reusing it instead when it's already active.
TransactionalExecutor that lazily materializes its resource, so
invalid reference
TransactionalExecutorProvider#applyPreferringIndependent
Deliberately kept off TransactionalExecutor itself: materialization awareness is a
provider-orchestration concern, not an operation a consumer of a TransactionalExecutor should
ever need - consumers only need accept/apply.
- Since:
- 5.4.0
- Author:
- John Hendrikx
-
Method Summary
Modifier and TypeMethodDescription<R> RwithMaterializationShielded(Function<Boolean, R> decision) Runsdecision, passing whether this executor already has a resource materialized, while preventing a concurrentTransactionalExecutor.apply(org.axonframework.common.function.ThrowingFunction<T, R, java.lang.Exception>)call from materializing it for the duration - so a caller can fall back to an independent executor without racing a concurrent materialization.
-
Method Details
-
withMaterializationShielded
Runsdecision, passing whether this executor already has a resource materialized, while preventing a concurrentTransactionalExecutor.apply(org.axonframework.common.function.ThrowingFunction<T, R, java.lang.Exception>)call from materializing it for the duration - so a caller can fall back to an independent executor without racing a concurrent materialization.- Type Parameters:
R- the type of the result produced bydecision- Parameters:
decision- giventrueif this executor already has a resource materialized, otherwisefalse; run shielded from a concurrent materialization, cannot benull- Returns:
- the result of
decision - Throws:
NullPointerException- whendecisionisnull
-