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
ConstructorDescriptionRecoveryManagerImpl
(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 aSet
containing 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.void
init
(RpcManager rpcManager, CommandsFactory commandsFactory, ComponentRef<TransactionTable> txTable, TransactionCoordinator txCoordinator, TransactionFactory txFactory) boolean
isTransactionPrepared
(GlobalTransaction globalTx) Checks both internal state and transaction table's state for the given tx.void
registerInDoubtTransaction
(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:RecoveryManager
Returns 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:
getPreparedTransactionsFromCluster
in interfaceRecoveryManager
-
removeRecoveryInformation
public CompletionStage<Void> removeRecoveryInformation(Collection<Address> lockOwners, XidImpl xid, GlobalTransaction gtx, boolean fromCluster) Description copied from interface:RecoveryManager
Removes from the specified nodes (or all nodes if the value of 'where' is null) the recovery information associated with these Xids.- Specified by:
removeRecoveryInformation
in interfaceRecoveryManager
- Parameters:
lockOwners
- on which nodes should this be executed.xid
- the list of xids to be removed.gtx
- the global transactionfromCluster
-true
to remove the recovery information from all cluster.
-
removeRecoveryInformationFromCluster
public CompletionStage<Void> removeRecoveryInformationFromCluster(Collection<Address> where, long internalId) Description copied from interface:RecoveryManager
Same asRecoveryManager.removeRecoveryInformation(Collection, XidImpl, GlobalTransaction, boolean)
but the transaction is identified by its internal id, and not by its xid.- Specified by:
removeRecoveryInformationFromCluster
in interfaceRecoveryManager
-
removeRecoveryInformation
Description copied from interface:RecoveryManager
Remove recovery information stored on this node (doesn't involve rpc).- Specified by:
removeRecoveryInformation
in interfaceRecoveryManager
- See Also:
-
removeRecoveryInformation
Description copied from interface:RecoveryManager
Same asRecoveryManager.removeRecoveryInformation(XidImpl)
but identifies the tx by its internal id.- Specified by:
removeRecoveryInformation
in interfaceRecoveryManager
-
getInDoubtTransactions
Description copied from interface:RecoveryManager
Local 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:
getInDoubtTransactions
in interfaceRecoveryManager
- See Also:
-
getInDoubtTransactionInfo
Description copied from interface:RecoveryManager
Same asRecoveryManager.getInDoubtTransactionInfoFromCluster()
, but only returns transactions from the local node.- Specified by:
getInDoubtTransactionInfo
in interfaceRecoveryManager
-
getInDoubtTransactionInfoFromCluster
Description copied from interface:RecoveryManager
Returns aSet
containing 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:
getInDoubtTransactionInfoFromCluster
in interfaceRecoveryManager
- See Also:
-
registerInDoubtTransaction
- Specified by:
registerInDoubtTransaction
in interfaceRecoveryManager
-
getPreparedTransaction
Description copied from interface:RecoveryManager
Local call returning the remote transaction identified by the supplied xid or null.- Specified by:
getPreparedTransaction
in interfaceRecoveryManager
-
forceTransactionCompletion
Description copied from interface:RecoveryManager
Replays 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:
forceTransactionCompletion
in interfaceRecoveryManager
- Parameters:
xid
- tx to commit or rollbackcommit
- if true tx is committed, if false it is rolled back
-
forceTransactionCompletionFromCluster
Description copied from interface:RecoveryManager
This method invokesRecoveryManager.forceTransactionCompletion(XidImpl, boolean)
on the specified node.- Specified by:
forceTransactionCompletionFromCluster
in interfaceRecoveryManager
-
isTransactionPrepared
Description copied from interface:RecoveryManager
Checks both internal state and transaction table's state for the given tx. If it finds it, returns true if tx is prepared.- Specified by:
isTransactionPrepared
in interfaceRecoveryManager
-
getInDoubtTransactionsMap
-