Class RecoveryManagerImpl
- java.lang.Object
-
- org.infinispan.transaction.xa.recovery.RecoveryManagerImpl
-
- All Implemented Interfaces:
RecoveryManager
public class RecoveryManagerImpl extends Object implements RecoveryManager
Default implementation forRecoveryManager- Since:
- 5.0
- Author:
- Mircea.Markus@jboss.com
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.transaction.xa.recovery.RecoveryManager
RecoveryManager.InDoubtTxInfo, RecoveryManager.RecoveryIterator
-
-
Constructor Summary
Constructors Constructor Description RecoveryManagerImpl(ConcurrentMap<RecoveryInfoKey,RecoveryAwareRemoteTransaction> recoveryHolder, String cacheName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringforceTransactionCompletion(Xid xid, boolean commit)Replays the given transaction by re-running the prepare and commit.StringforceTransactionCompletionFromCluster(Xid xid, Address where, boolean commit)This method invokesRecoveryManager.forceTransactionCompletion(javax.transaction.xa.Xid, boolean)on the specified node.Set<RecoveryManager.InDoubtTxInfo>getInDoubtTransactionInfo()Same asRecoveryManager.getInDoubtTransactionInfoFromCluster(), but only returns transactions from the local node.Set<RecoveryManager.InDoubtTxInfo>getInDoubtTransactionInfoFromCluster()Returns aSetcontaining all the in-doubt transactions from the cluster, including the local node.List<Xid>getInDoubtTransactions()Local call that returns a list containing:ConcurrentMap<RecoveryInfoKey,RecoveryAwareRemoteTransaction>getInDoubtTransactionsMap()RecoveryAwareRemoteTransactiongetPreparedTransaction(Xid xid)Local call returning the remote transaction identified by the supplied xid or null.RecoveryManager.RecoveryIteratorgetPreparedTransactionsFromCluster()Returns the list of transactions in prepared state from both local and remote cluster nodes.voidinit(RpcManager rpcManager, org.infinispan.commands.CommandsFactory commandsFactory, org.infinispan.factories.impl.ComponentRef<org.infinispan.transaction.impl.TransactionTable> txTable, org.infinispan.transaction.impl.TransactionCoordinator txCoordinator, TransactionFactory txFactory)booleanisTransactionPrepared(GlobalTransaction globalTx)Checks both internal state and transaction table's state for the given tx.voidregisterInDoubtTransaction(RecoveryAwareRemoteTransaction remoteTransaction)RecoveryAwareTransactionremoveRecoveryInformation(Long internalId)Same asRecoveryManager.removeRecoveryInformation(javax.transaction.xa.Xid)but identifies the tx by its internal id.voidremoveRecoveryInformation(Collection<Address> lockOwners, Xid xid, boolean sync, 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.RecoveryAwareTransactionremoveRecoveryInformation(Xid xid)Remove recovery information stored on this node (doesn't involve rpc).voidremoveRecoveryInformationFromCluster(Collection<Address> where, long internalId, boolean sync)Same asRecoveryManager.removeRecoveryInformation(java.util.Collection, javax.transaction.xa.Xid, boolean, org.infinispan.transaction.xa.GlobalTransaction, boolean)but the transaction is identified by its internal id, and not by its xid.
-
-
-
Constructor Detail
-
RecoveryManagerImpl
public RecoveryManagerImpl(ConcurrentMap<RecoveryInfoKey,RecoveryAwareRemoteTransaction> recoveryHolder, String cacheName)
-
-
Method Detail
-
init
public void init(RpcManager rpcManager, org.infinispan.commands.CommandsFactory commandsFactory, org.infinispan.factories.impl.ComponentRef<org.infinispan.transaction.impl.TransactionTable> txTable, org.infinispan.transaction.impl.TransactionCoordinator txCoordinator, TransactionFactory txFactory)
-
getPreparedTransactionsFromCluster
public RecoveryManager.RecoveryIterator 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 void removeRecoveryInformation(Collection<Address> lockOwners, Xid xid, boolean sync, 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.sync- execute sync or async (false)gtx- the global transaction
-
removeRecoveryInformationFromCluster
public void removeRecoveryInformationFromCluster(Collection<Address> where, long internalId, boolean sync)
Description copied from interface:RecoveryManagerSame asRecoveryManager.removeRecoveryInformation(java.util.Collection, javax.transaction.xa.Xid, boolean, org.infinispan.transaction.xa.GlobalTransaction, boolean)but the transaction is identified by its internal id, and not by its xid.- Specified by:
removeRecoveryInformationFromClusterin interfaceRecoveryManager
-
removeRecoveryInformation
public RecoveryAwareTransaction removeRecoveryInformation(Xid xid)
Description copied from interface:RecoveryManagerRemove recovery information stored on this node (doesn't involve rpc).- Specified by:
removeRecoveryInformationin interfaceRecoveryManager- See Also:
#removeRecoveryInformation(java.util.Collection, javax.transaction.xa.Xid, boolean)
-
removeRecoveryInformation
public RecoveryAwareTransaction removeRecoveryInformation(Long internalId)
Description copied from interface:RecoveryManagerSame asRecoveryManager.removeRecoveryInformation(javax.transaction.xa.Xid)but identifies the tx by its internal id.- Specified by:
removeRecoveryInformationin interfaceRecoveryManager
-
getInDoubtTransactions
public List<Xid> 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:
RecoveryAwareRemoteTransaction.isInDoubt()
-
getInDoubtTransactionInfo
public Set<RecoveryManager.InDoubtTxInfo> getInDoubtTransactionInfo()
Description copied from interface:RecoveryManagerSame asRecoveryManager.getInDoubtTransactionInfoFromCluster(), but only returns transactions from the local node.- Specified by:
getInDoubtTransactionInfoin interfaceRecoveryManager
-
getInDoubtTransactionInfoFromCluster
public Set<RecoveryManager.InDoubtTxInfo> 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:
RecoveryManager.InDoubtTxInfo
-
registerInDoubtTransaction
public void registerInDoubtTransaction(RecoveryAwareRemoteTransaction remoteTransaction)
- Specified by:
registerInDoubtTransactionin interfaceRecoveryManager
-
getPreparedTransaction
public RecoveryAwareRemoteTransaction getPreparedTransaction(Xid xid)
Description copied from interface:RecoveryManagerLocal call returning the remote transaction identified by the supplied xid or null.- Specified by:
getPreparedTransactionin interfaceRecoveryManager
-
forceTransactionCompletion
public String forceTransactionCompletion(Xid xid, boolean commit)
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
public String forceTransactionCompletionFromCluster(Xid xid, Address where, boolean commit)
Description copied from interface:RecoveryManagerThis method invokesRecoveryManager.forceTransactionCompletion(javax.transaction.xa.Xid, boolean)on the specified node.- Specified by:
forceTransactionCompletionFromClusterin interfaceRecoveryManager
-
isTransactionPrepared
public boolean isTransactionPrepared(GlobalTransaction globalTx)
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
public ConcurrentMap<RecoveryInfoKey,RecoveryAwareRemoteTransaction> getInDoubtTransactionsMap()
-
-