Class ComposableTransactionWriter
java.lang.Object
org.springframework.data.gemfire.transaction.event.ComposableTransactionWriter
- All Implemented Interfaces:
CacheCallback
,Declarable
,TransactionWriter
An implementation of Apache Geode's
TransactionWriter
interface that uses the Composite Software Design
Pattern to compose multiple TransactionWriter
objects into a single instance.- Since:
- 2.3.0
- Author:
- John Blum
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeCommit
(TransactionEvent event) void
close()
static TransactionWriter
compose
(TransactionWriter transactionWriterOne, TransactionWriter transactionWriterTwo) Factory method used to construct and compose 2TransactionWriter
objects into a composite instance ofTransactionWriter
functioning as a single instance.protected TransactionWriter
Returns a reference to the firstTransactionWriter
in the composition.protected TransactionWriter
Returns a reference to the secondTransactionWriter
in the composition.void
init
(Properties properties) void
initialize
(Cache cache, Properties properties)
-
Method Details
-
compose
@Nullable public static TransactionWriter compose(@Nullable TransactionWriter transactionWriterOne, @Nullable TransactionWriter transactionWriterTwo) Factory method used to construct and compose 2TransactionWriter
objects into a composite instance ofTransactionWriter
functioning as a single instance.- Parameters:
transactionWriterOne
- firstTransactionWriter
in the composition.transactionWriterTwo
- secondTransactionWriter
in the composition.- Returns:
- the first
TransactionWriter
if the secondTransactionWriter
is null, or return the secondTransactionWriter
if the firstTransactionWriter
is null, or return the composition of bothTransactionWriter
one andTransactionWriter
two. - See Also:
-
getTransactionWriterOne
Returns a reference to the firstTransactionWriter
in the composition.- Returns:
- a reference to the first
TransactionWriter
in the composition. - See Also:
-
getTransactionWriterTwo
Returns a reference to the secondTransactionWriter
in the composition.- Returns:
- a reference to the second
TransactionWriter
in the composition. - See Also:
-
beforeCommit
- Specified by:
beforeCommit
in interfaceTransactionWriter
- Throws:
TransactionWriterException
-
close
public void close()- Specified by:
close
in interfaceCacheCallback
-
init
- Specified by:
init
in interfaceDeclarable
-
initialize
- Specified by:
initialize
in interfaceDeclarable
-