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
ConstructorDescriptionPrepareCoordinator
(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 TxState
final boolean
int
onePhaseCommitRemoteTransaction
(GlobalTransaction gtx, List<org.infinispan.commands.write.WriteCommand> modifications) Commits a remote 1PC transaction that is already in MARK_COMMIT stateint
prepare
(boolean onePhaseCommit) Prepares the transaction.int
rollback()
Rollbacks the transaction if an exception happens during the transaction execution.final void
Rollbacks a transaction that is remove in all the cluster members.void
Marks the transaction as rollback-only.boolean
Starts a transaction.
-
Constructor Details
-
PrepareCoordinator
public PrepareCoordinator(AdvancedCache<byte[], byte[]> cache, XidImpl xid, boolean recoverable, long transactionTimeout)
-
-
Method Details
-
getTxState
- Returns:
- The current
TxState
associated to the transaction.
-
isAlive
- Returns:
true
if theaddress
is still in the cluster.
-
rollbackRemoteTransaction
Rollbacks a transaction that is remove in all the cluster members. -
startTransaction
public boolean startTransaction()Starts a transaction.- Returns:
true
if the transaction can be started,false
otherwise.
-
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
-true
if one phase commit.- Returns:
- the
XAResource.XA_OK
if successful prepared, otherwise one of theXAException
error 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
-