Class PrepareCoordinator


  • public class PrepareCoordinator
    extends Object
    A class that handles the prepare request from the Hot Rod clients.
    Since:
    9.4
    Author:
    Pedro Ruivo
    • 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 the address 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 the XAException 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,
                                                   List<org.infinispan.commands.write.WriteCommand> modifications)
        Commits a remote 1PC transaction that is already in MARK_COMMIT state