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 TransactionXaAdapter
s (locally
originated transactions).- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
protected boolean
protected CommandsFactory
protected Configuration
protected PartitionHandlingManager
protected RpcManager
protected boolean
protected TransactionOriginatorChecker
protected TransactionCoordinator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionafterCompletion
(LocalTransaction localTransaction, int status) beforeCompletion
(LocalTransaction localTransaction) void
cleanupLeaverTransactions
(List<Address> members) boolean
containRemoteTx
(GlobalTransaction globalTransaction) boolean
containsLocalTx
(GlobalTransaction globalTransaction) void
enlist
(javax.transaction.Transaction transaction, LocalTransaction localTransaction) void
enlistClientTransaction
(javax.transaction.Transaction transaction, LocalTransaction localTransaction) void
failureCompletingTransaction
(javax.transaction.Transaction tx) getGlobalTransaction
(javax.transaction.Transaction transaction) getLocalTransaction
(javax.transaction.Transaction tx) Looks up a LocalTransaction given a GlobalTransaction.int
int
getOrCreateLocalTransaction
(javax.transaction.Transaction transaction, boolean implicitTransaction) Returns theTransactionXaAdapter
corresponding 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 theRemoteTransaction
associated with the supplied transaction id.int
boolean
void
localTransactionPrepared
(LocalTransaction localTransaction) void
markTransactionCompleted
(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.void
onTopologyChange
(TopologyChangedEvent<?, ?> tce) void
protected final void
recalculateMinTopologyIdIfNeeded
(CacheTransaction removedTransaction) protected final void
releaseLocksForCompletedTransaction
(LocalTransaction localTransaction, boolean committedInOnePhase) void
remoteTransactionCommitted
(GlobalTransaction gtx, boolean onePc) Removes theRemoteTransaction
corresponding to the given tx.void
void
boolean
removeLocalTransaction
(LocalTransaction localTransaction) Removes theTransactionXaAdapter
corresponding to the given tx.final RemoteTransaction
void
start()
-
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:
getGlobalTransaction
in interfaceTransactionTable
- Parameters:
transaction
- the local transaction. Must be non-null.- Returns:
- the
GlobalTransaction
associated with the transaction ornull
if doesn't exists.
-
getLocalGlobalTransaction
- Specified by:
getLocalGlobalTransaction
in interfaceTransactionTable
- Returns:
- an unmodified collection of
GlobalTransaction
associated with local running transactions.
-
getRemoteGlobalTransaction
- Specified by:
getRemoteGlobalTransaction
in interfaceTransactionTable
- Returns:
- an unmodified collection of
GlobalTransaction
associated 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 theRemoteTransaction
corresponding to the given tx. -
onViewChange
-
getRemoteTransaction
Returns theRemoteTransaction
associated 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 theTransactionXaAdapter
corresponding 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 theTransactionXaAdapter
corresponding 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
- See Also:
-
getCompletedTransactionStatus
public TransactionTable.CompletedTransactionStatus getCompletedTransactionStatus(GlobalTransaction gtx) - See Also:
-
beforeCompletion
-
afterCompletion
-
releaseLocksForCompletedTransaction
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase)
-