Package org.infinispan.server.hotrod.tx
Class PrepareCoordinator
java.lang.Object
org.infinispan.server.hotrod.tx.PrepareCoordinator
A class that handles the prepare request from the Hot Rod clients.
- Since:
- 9.4
- Author:
- Pedro Ruivo
-
Constructor Summary
ConstructorsConstructorDescriptionPrepareCoordinator(AdvancedCache<byte[], byte[]> cache, XidImpl xid, boolean recoverable, long transactionTimeout) -
Method Summary
Modifier and TypeMethodDescription<K,V> AdvancedCache<K, V> decorateCache(AdvancedCache<K, V> cache) Decorates the cache with the transaction created.final TxStatefinal booleanintonePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<org.infinispan.commands.write.WriteCommand> modifications) Commits a remote 1PC transaction that is already in MARK_COMMIT stateintprepare(boolean onePhaseCommit) Prepares the transaction.introllback()Rollbacks the transaction if an exception happens during the transaction execution.final voidRollbacks a transaction that is remove in all the cluster members.voidMarks the transaction as rollback-only.booleanStarts a transaction.
-
Constructor Details
-
PrepareCoordinator
public PrepareCoordinator(AdvancedCache<byte[], byte[]> cache, XidImpl xid, boolean recoverable, long transactionTimeout)
-
-
Method Details
-
getTxState
- Returns:
- The current
TxStateassociated to the transaction.
-
isAlive
- Returns:
trueif theaddressis still in the cluster.
-
rollbackRemoteTransaction
Rollbacks a transaction that is remove in all the cluster members. -
startTransaction
public boolean startTransaction()Starts a transaction.- Returns:
trueif the transaction can be started,falseotherwise.
-
rollback
public int rollback()Rollbacks the transaction if an exception happens during the transaction execution. -
setRollbackOnly
public void setRollbackOnly()Marks the transaction as rollback-only. -
prepare
public int prepare(boolean onePhaseCommit) Prepares the transaction.- Parameters:
onePhaseCommit-trueif one phase commit.- Returns:
- the
XAResource.XA_OKif successful prepared, otherwise one of theXAExceptionerror codes.
-
decorateCache
Decorates the cache with the transaction created. -
onePhaseCommitRemoteTransaction
public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<org.infinispan.commands.write.WriteCommand> modifications) Commits a remote 1PC transaction that is already in MARK_COMMIT state
-