public class TransactionCoordinator extends Object
| Modifier and Type | Field and Description |
|---|---|
protected TransactionId |
transactionId |
protected TransactionManager |
transactionManager |
protected Set<TransactionParticipant> |
transactionParticipants |
| Constructor and Description |
|---|
TransactionCoordinator(TransactionId transactionId,
TransactionManager transactionManager) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<CommitStatus> |
commit()
Commits the transaction.
|
protected CompletableFuture<Void> |
commit(Set<TransactionParticipant> transactionParticipants)
Performs the commit phase of the two-phase commit protocol for the given transaction participants.
|
<K,V> TransactionalMap<K,V> |
getTransactionalMap(String name,
Serializer serializer)
Returns a transactional map for this transaction.
|
protected CompletableFuture<Boolean> |
prepare(Set<TransactionParticipant> transactionParticipants)
Performs the prepare phase of the two-phase commit protocol for the given transaction participants.
|
protected CompletableFuture<Void> |
rollback(Set<TransactionParticipant> transactionParticipants)
Rolls back transactions for the given participants.
|
String |
toString() |
protected final TransactionId transactionId
protected final TransactionManager transactionManager
protected final Set<TransactionParticipant> transactionParticipants
public TransactionCoordinator(TransactionId transactionId, TransactionManager transactionManager)
public <K,V> TransactionalMap<K,V> getTransactionalMap(String name, Serializer serializer)
K - key typeV - value typename - the transactional map nameserializer - the serializerpublic CompletableFuture<CommitStatus> commit()
protected CompletableFuture<Boolean> prepare(Set<TransactionParticipant> transactionParticipants)
transactionParticipants - the transaction participants for which to prepare the transactionprotected CompletableFuture<Void> commit(Set<TransactionParticipant> transactionParticipants)
transactionParticipants - the transaction participants for which to commit the transactionprotected CompletableFuture<Void> rollback(Set<TransactionParticipant> transactionParticipants)
transactionParticipants - the transaction participants for which to roll back the transaction