Package org.infinispan.server.hotrod.tx
Class PrepareCoordinator
- java.lang.Object
-
- org.infinispan.server.hotrod.tx.PrepareCoordinator
-
public class PrepareCoordinator extends java.lang.Object
A class that handles the prepare request from the Hot Rod clients.- Since:
- 9.4
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description PrepareCoordinator(AdvancedCache<byte[],byte[]> cache, XidImpl xid, boolean recoverable, long transactionTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
AdvancedCache<K,V>decorateCache(AdvancedCache<K,V> cache)
Decorates the cache with the transaction created.TxState
getTxState()
boolean
isAlive(Address address)
int
onePhaseCommitRemoteTransaction(GlobalTransaction gtx, java.util.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.void
rollbackRemoteTransaction(GlobalTransaction gtx)
Rollbacks a transaction that is remove in all the cluster members.void
setRollbackOnly()
Marks the transaction as rollback-only.boolean
startTransaction()
Starts a transaction.
-
-
-
Constructor Detail
-
PrepareCoordinator
public PrepareCoordinator(AdvancedCache<byte[],byte[]> cache, XidImpl xid, boolean recoverable, long transactionTimeout)
-
-
Method Detail
-
getTxState
public final TxState getTxState()
- Returns:
- The current
TxState
associated to the transaction.
-
isAlive
public final boolean isAlive(Address address)
- Returns:
true
if theaddress
is still in the cluster.
-
rollbackRemoteTransaction
public final void rollbackRemoteTransaction(GlobalTransaction gtx)
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
public <K,V> AdvancedCache<K,V> decorateCache(AdvancedCache<K,V> cache)
Decorates the cache with the transaction created.
-
onePhaseCommitRemoteTransaction
public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, java.util.List<org.infinispan.commands.write.WriteCommand> modifications)
Commits a remote 1PC transaction that is already in MARK_COMMIT state
-
-