Class RecoveryManagerImpl
java.lang.Object
org.infinispan.transaction.xa.recovery.RecoveryManagerImpl
- All Implemented Interfaces:
RecoveryManager
Default implementation for
RecoveryManager- Since:
- 5.0
- Author:
- Mircea.Markus@jboss.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.transaction.xa.recovery.RecoveryManager
RecoveryManager.RecoveryIterator -
Constructor Summary
ConstructorsConstructorDescriptionRecoveryManagerImpl(ConcurrentMap<RecoveryInfoKey, RecoveryAwareRemoteTransaction> recoveryHolder, String cacheName) -
Method Summary
Modifier and TypeMethodDescriptionforceTransactionCompletion(XidImpl xid, boolean commit) Replays the given transaction by re-running the prepare and commit.forceTransactionCompletionFromCluster(XidImpl xid, Address where, boolean commit) This method invokesRecoveryManager.forceTransactionCompletion(XidImpl, boolean)on the specified node.Same asRecoveryManager.getInDoubtTransactionInfoFromCluster(), but only returns transactions from the local node.Returns aSetcontaining all the in-doubt transactions from the cluster, including the local node.Local call that returns a list containing:Local call returning the remote transaction identified by the supplied xid or null.Returns the list of transactions in prepared state from both local and remote cluster nodes.voidinit(RpcManager rpcManager, CommandsFactory commandsFactory, ComponentRef<TransactionTable> txTable, TransactionCoordinator txCoordinator, TransactionFactory txFactory) booleanisTransactionPrepared(GlobalTransaction globalTx) Checks both internal state and transaction table's state for the given tx.voidregisterInDoubtTransaction(RecoveryAwareRemoteTransaction remoteTransaction) removeRecoveryInformation(Long internalId) Same asRecoveryManager.removeRecoveryInformation(XidImpl)but identifies the tx by its internal id.removeRecoveryInformation(Collection<Address> lockOwners, XidImpl xid, GlobalTransaction gtx, boolean fromCluster) Removes from the specified nodes (or all nodes if the value of 'where' is null) the recovery information associated with these Xids.Remove recovery information stored on this node (doesn't involve rpc).removeRecoveryInformationFromCluster(Collection<Address> where, long internalId) Same asRecoveryManager.removeRecoveryInformation(Collection, XidImpl, GlobalTransaction, boolean)but the transaction is identified by its internal id, and not by its xid.
-
Constructor Details
-
RecoveryManagerImpl
public RecoveryManagerImpl(ConcurrentMap<RecoveryInfoKey, RecoveryAwareRemoteTransaction> recoveryHolder, String cacheName)
-
-
Method Details
-
init
public void init(RpcManager rpcManager, CommandsFactory commandsFactory, ComponentRef<TransactionTable> txTable, TransactionCoordinator txCoordinator, TransactionFactory txFactory) -
getPreparedTransactionsFromCluster
Description copied from interface:RecoveryManagerReturns the list of transactions in prepared state from both local and remote cluster nodes. Implementation can take advantage of several optimisations:- in order to get all tx from the cluster a broadcast is performed. This can be performed only once (assuming the call is successful), the first time this method is called. After that a local, cached list of tx prepared on this node is returned.
- during the broadcast just return the list of prepared transactions that are not originated on other active nodes of the cluster.
- Specified by:
getPreparedTransactionsFromClusterin interfaceRecoveryManager
-
removeRecoveryInformation
public CompletionStage<Void> removeRecoveryInformation(Collection<Address> lockOwners, XidImpl xid, GlobalTransaction gtx, boolean fromCluster) Description copied from interface:RecoveryManagerRemoves from the specified nodes (or all nodes if the value of 'where' is null) the recovery information associated with these Xids.- Specified by:
removeRecoveryInformationin interfaceRecoveryManager- Parameters:
lockOwners- on which nodes should this be executed.xid- the list of xids to be removed.gtx- the global transactionfromCluster-trueto remove the recovery information from all cluster.
-
removeRecoveryInformationFromCluster
public CompletionStage<Void> removeRecoveryInformationFromCluster(Collection<Address> where, long internalId) Description copied from interface:RecoveryManagerSame asRecoveryManager.removeRecoveryInformation(Collection, XidImpl, GlobalTransaction, boolean)but the transaction is identified by its internal id, and not by its xid.- Specified by:
removeRecoveryInformationFromClusterin interfaceRecoveryManager
-
removeRecoveryInformation
Description copied from interface:RecoveryManagerRemove recovery information stored on this node (doesn't involve rpc).- Specified by:
removeRecoveryInformationin interfaceRecoveryManager- See Also:
-
removeRecoveryInformation
Description copied from interface:RecoveryManagerSame asRecoveryManager.removeRecoveryInformation(XidImpl)but identifies the tx by its internal id.- Specified by:
removeRecoveryInformationin interfaceRecoveryManager
-
getInDoubtTransactions
Description copied from interface:RecoveryManagerLocal call that returns a list containing:- all the remote transactions prepared on this node for which the originator(i.e. the node where the tx stared) is no longer part of the cluster. AND - all the locally originated transactions which are prepared and for which the commit failed
- Specified by:
getInDoubtTransactionsin interfaceRecoveryManager- See Also:
-
getInDoubtTransactionInfo
Description copied from interface:RecoveryManagerSame asRecoveryManager.getInDoubtTransactionInfoFromCluster(), but only returns transactions from the local node.- Specified by:
getInDoubtTransactionInfoin interfaceRecoveryManager
-
getInDoubtTransactionInfoFromCluster
Description copied from interface:RecoveryManagerReturns aSetcontaining all the in-doubt transactions from the cluster, including the local node. This does not include transactions that are prepared successfully and for which the originator is still in the cluster.- Specified by:
getInDoubtTransactionInfoFromClusterin interfaceRecoveryManager- See Also:
-
registerInDoubtTransaction
- Specified by:
registerInDoubtTransactionin interfaceRecoveryManager
-
getPreparedTransaction
Description copied from interface:RecoveryManagerLocal call returning the remote transaction identified by the supplied xid or null.- Specified by:
getPreparedTransactionin interfaceRecoveryManager
-
forceTransactionCompletion
Description copied from interface:RecoveryManagerReplays the given transaction by re-running the prepare and commit. This call expects the transaction to exist on this node either as a local or remote transaction.- Specified by:
forceTransactionCompletionin interfaceRecoveryManager- Parameters:
xid- tx to commit or rollbackcommit- if true tx is committed, if false it is rolled back
-
forceTransactionCompletionFromCluster
Description copied from interface:RecoveryManagerThis method invokesRecoveryManager.forceTransactionCompletion(XidImpl, boolean)on the specified node.- Specified by:
forceTransactionCompletionFromClusterin interfaceRecoveryManager
-
isTransactionPrepared
Description copied from interface:RecoveryManagerChecks both internal state and transaction table's state for the given tx. If it finds it, returns true if tx is prepared.- Specified by:
isTransactionPreparedin interfaceRecoveryManager
-
getInDoubtTransactionsMap
-