Package org.infinispan.transaction.impl
Class TransactionTable
java.lang.Object
org.infinispan.transaction.impl.TransactionTable
- All Implemented Interfaces:
TransactionTable
- Direct Known Subclasses:
XaTransactionTable
Repository for
RemoteTransaction and TransactionXaAdapters (locally
originated transactions).- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected booleanprotected CommandsFactoryprotected Configurationprotected PartitionHandlingManagerprotected RpcManagerprotected booleanprotected TransactionOriginatorCheckerprotected TransactionCoordinator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterCompletion(LocalTransaction localTransaction, int status) beforeCompletion(LocalTransaction localTransaction) voidcleanupLeaverTransactions(List<Address> members) booleancontainRemoteTx(GlobalTransaction globalTransaction) booleancontainsLocalTx(GlobalTransaction globalTransaction) voidenlist(javax.transaction.Transaction transaction, LocalTransaction localTransaction) voidenlistClientTransaction(javax.transaction.Transaction transaction, LocalTransaction localTransaction) voidfailureCompletingTransaction(javax.transaction.Transaction tx) getGlobalTransaction(javax.transaction.Transaction transaction) getLocalTransaction(javax.transaction.Transaction tx) Looks up a LocalTransaction given a GlobalTransaction.intintgetOrCreateLocalTransaction(javax.transaction.Transaction transaction, boolean implicitTransaction) Returns theTransactionXaAdaptercorresponding to the supplied transaction.getOrCreateLocalTransaction(javax.transaction.Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) Similar togetOrCreateLocalTransaction(Transaction, boolean)but with a custom global transaction factory.getOrCreateRemoteTransaction(GlobalTransaction globalTx, List<org.infinispan.commands.write.WriteCommand> modifications) Returns an existing remote transaction or creates one if none exists.getOrCreateRemoteTransaction(GlobalTransaction globalTx, List<org.infinispan.commands.write.WriteCommand> modifications, int topologyId) Returns theRemoteTransactionassociated with the supplied transaction id.intbooleanvoidlocalTransactionPrepared(LocalTransaction localTransaction) voidmarkTransactionCompleted(GlobalTransaction gtx, boolean successful) With the current state transfer implementation it is possible for a transaction to be prepared several times on a remote node.voidonTopologyChange(TopologyChangedEvent<?, ?> tce) voidprotected final voidrecalculateMinTopologyIdIfNeeded(CacheTransaction removedTransaction) protected final voidreleaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase) voidremoteTransactionCommitted(GlobalTransaction gtx, boolean onePc) Removes theRemoteTransactioncorresponding to the given tx.voidvoidbooleanremoveLocalTransaction(LocalTransaction localTransaction) Removes theTransactionXaAdaptercorresponding to the given tx.final RemoteTransactionvoidstart()
-
Field Details
-
CACHE_STOPPED_TOPOLOGY_ID
public static final int CACHE_STOPPED_TOPOLOGY_ID- See Also:
-
configuration
-
txCoordinator
-
rpcManager
-
commandsFactory
-
partitionHandlingManager
-
transactionOriginatorChecker
-
clustered
protected boolean clustered -
running
protected volatile boolean running
-
-
Constructor Details
-
TransactionTable
public TransactionTable()
-
-
Method Details
-
start
public void start() -
getGlobalTransaction
- Specified by:
getGlobalTransactionin interfaceTransactionTable- Parameters:
transaction- the local transaction. Must be non-null.- Returns:
- the
GlobalTransactionassociated with the transaction ornullif doesn't exists.
-
getLocalGlobalTransaction
- Specified by:
getLocalGlobalTransactionin interfaceTransactionTable- Returns:
- an unmodified collection of
GlobalTransactionassociated with local running transactions.
-
getRemoteGlobalTransaction
- Specified by:
getRemoteGlobalTransactionin interfaceTransactionTable- Returns:
- an unmodified collection of
GlobalTransactionassociated with remote transactions.
-
remoteTransactionPrepared
-
localTransactionPrepared
-
enlist
-
enlistClientTransaction
public void enlistClientTransaction(javax.transaction.Transaction transaction, LocalTransaction localTransaction) -
failureCompletingTransaction
public void failureCompletingTransaction(javax.transaction.Transaction tx) -
getMinTopologyId
public int getMinTopologyId() -
cleanupLeaverTransactions
-
remoteTransactionCommitted
Removes theRemoteTransactioncorresponding to the given tx. -
onViewChange
-
getRemoteTransaction
Returns theRemoteTransactionassociated with the supplied transaction id. Returns null if no such association exists. -
remoteTransactionRollback
-
getOrCreateRemoteTransaction
public RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, List<org.infinispan.commands.write.WriteCommand> modifications) Returns an existing remote transaction or creates one if none exists. Atomicity: this method supports concurrent invocations, guaranteeing that all threads will see the same transaction object. -
getOrCreateRemoteTransaction
public RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, List<org.infinispan.commands.write.WriteCommand> modifications, int topologyId) -
getOrCreateLocalTransaction
public LocalTransaction getOrCreateLocalTransaction(javax.transaction.Transaction transaction, boolean implicitTransaction) Returns theTransactionXaAdaptercorresponding to the supplied transaction. If none exists, will be created first. -
getOrCreateLocalTransaction
public LocalTransaction getOrCreateLocalTransaction(javax.transaction.Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) Similar togetOrCreateLocalTransaction(Transaction, boolean)but with a custom global transaction factory. -
removeLocalTransaction
Removes theTransactionXaAdaptercorresponding to the given tx. Returns true if such an tx exists. -
removeRemoteTransaction
-
getRemoteTxCount
public int getRemoteTxCount() -
getLocalTxCount
public int getLocalTxCount() -
getLocalTransaction
Looks up a LocalTransaction given a GlobalTransaction.- Parameters:
txId- the global transaction identifier- Returns:
- the LocalTransaction or null if not found
-
containsLocalTx
-
getLocalTransaction
-
containRemoteTx
-
getRemoteTransactions
-
getLocalTransactions
-
recalculateMinTopologyIdIfNeeded
-
onTopologyChange
-
markTransactionCompleted
With the current state transfer implementation it is possible for a transaction to be prepared several times on a remote node. This might cause leaks, e.g. if the transaction is prepared, committed and prepared again. Once marked as completed (because of commit or rollback) any further prepare received on that transaction are discarded. -
isTransactionCompleted
-
getCompletedTransactionStatus
public TransactionTable.CompletedTransactionStatus getCompletedTransactionStatus(GlobalTransaction gtx) -
beforeCompletion
-
afterCompletion
-
releaseLocksForCompletedTransaction
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase)
-