Class PrepareCoordinator

java.lang.Object
org.infinispan.server.hotrod.tx.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 Summary

    Constructors
    Constructor
    Description
    PrepareCoordinator(org.infinispan.AdvancedCache<byte[],byte[]> cache, org.infinispan.commons.tx.XidImpl xid, boolean recoverable, long transactionTimeout)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <K, V> org.infinispan.AdvancedCache<K,V>
    decorateCache(org.infinispan.AdvancedCache<K,V> cache)
    Decorates the cache with the transaction created.
    final TxState
     
    final boolean
    isAlive(org.infinispan.remoting.transport.Address address)
     
    int
    onePhaseCommitRemoteTransaction(org.infinispan.transaction.xa.GlobalTransaction gtx, List<org.infinispan.commands.write.WriteCommand> modifications)
    Commits a remote 1PC transaction that is already in MARK_COMMIT state
    int
    prepare(boolean onePhaseCommit)
    Prepares the transaction.
    int
    Rollbacks the transaction if an exception happens during the transaction execution.
    final void
    rollbackRemoteTransaction(org.infinispan.transaction.xa.GlobalTransaction gtx)
    Rollbacks a transaction that is remove in all the cluster members.
    void
    Marks the transaction as rollback-only.
    boolean
    Starts a transaction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PrepareCoordinator

      public PrepareCoordinator(org.infinispan.AdvancedCache<byte[],byte[]> cache, org.infinispan.commons.tx.XidImpl xid, boolean recoverable, long transactionTimeout)
  • Method Details

    • getTxState

      public final TxState getTxState()
      Returns:
      The current TxState associated to the transaction.
    • isAlive

      public final boolean isAlive(org.infinispan.remoting.transport.Address address)
      Returns:
      true if the address is still in the cluster.
    • rollbackRemoteTransaction

      public final void rollbackRemoteTransaction(org.infinispan.transaction.xa.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> org.infinispan.AdvancedCache<K,V> decorateCache(org.infinispan.AdvancedCache<K,V> cache)
      Decorates the cache with the transaction created.
    • onePhaseCommitRemoteTransaction

      public int onePhaseCommitRemoteTransaction(org.infinispan.transaction.xa.GlobalTransaction gtx, List<org.infinispan.commands.write.WriteCommand> modifications)
      Commits a remote 1PC transaction that is already in MARK_COMMIT state