Package org.infinispan.transaction.impl
Class TransactionTable
- java.lang.Object
-
- org.infinispan.transaction.impl.TransactionTable
-
- All Implemented Interfaces:
TransactionTable
- Direct Known Subclasses:
XaTransactionTable
public class TransactionTable extends Object implements TransactionTable
Repository forRemoteTransaction
andTransactionXaAdapter
s (locally originated transactions).- Since:
- 4.0
- Author:
- Mircea.Markus@jboss.com, Galder ZamarreƱo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TransactionTable.CompletedTransactionStatus
-
Field Summary
Fields Modifier and Type Field Description static int
CACHE_STOPPED_TOPOLOGY_ID
protected boolean
clustered
protected CommandsFactory
commandsFactory
protected Configuration
configuration
protected PartitionHandlingManager
partitionHandlingManager
protected RpcManager
rpcManager
protected boolean
running
protected TransactionCoordinator
txCoordinator
-
Constructor Summary
Constructors Constructor Description TransactionTable()
-
Method Summary
-
-
-
Field Detail
-
CACHE_STOPPED_TOPOLOGY_ID
public static final int CACHE_STOPPED_TOPOLOGY_ID
- See Also:
- Constant Field Values
-
configuration
protected Configuration configuration
-
txCoordinator
protected TransactionCoordinator txCoordinator
-
rpcManager
protected RpcManager rpcManager
-
commandsFactory
protected CommandsFactory commandsFactory
-
partitionHandlingManager
protected PartitionHandlingManager partitionHandlingManager
-
clustered
protected boolean clustered
-
running
protected volatile boolean running
-
-
Method Detail
-
start
public void start()
-
getGlobalTransaction
public GlobalTransaction getGlobalTransaction(Transaction transaction)
- 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
public Collection<GlobalTransaction> getLocalGlobalTransaction()
- Specified by:
getLocalGlobalTransaction
in interfaceTransactionTable
- Returns:
- an unmodified collection of
GlobalTransaction
associated with local running transactions.
-
getRemoteGlobalTransaction
public Collection<GlobalTransaction> getRemoteGlobalTransaction()
- Specified by:
getRemoteGlobalTransaction
in interfaceTransactionTable
- Returns:
- an unmodified collection of
GlobalTransaction
associated with remote transactions.
-
remoteTransactionPrepared
public void remoteTransactionPrepared(GlobalTransaction gtx)
-
localTransactionPrepared
public void localTransactionPrepared(LocalTransaction localTransaction)
-
enlist
public void enlist(Transaction transaction, LocalTransaction localTransaction)
-
enlistClientTransaction
public void enlistClientTransaction(Transaction transaction, LocalTransaction localTransaction)
-
failureCompletingTransaction
public void failureCompletingTransaction(Transaction tx)
-
getMinTopologyId
public int getMinTopologyId()
-
getRemoteTransaction
public RemoteTransaction getRemoteTransaction(GlobalTransaction txId)
Returns theRemoteTransaction
associated with the supplied transaction id. Returns null if no such association exists.
-
remoteTransactionRollback
public void remoteTransactionRollback(GlobalTransaction gtx)
-
getOrCreateRemoteTransaction
public RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, 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.
-
getOrCreateLocalTransaction
public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction)
Returns theTransactionXaAdapter
corresponding to the supplied transaction. If none exists, will be created first.
-
getOrCreateLocalTransaction
public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory)
Similar togetOrCreateLocalTransaction(Transaction, boolean)
but with a custom global transaction factory.
-
removeLocalTransaction
public boolean removeLocalTransaction(LocalTransaction localTransaction)
Removes theTransactionXaAdapter
corresponding to the given tx. Returns true if such an tx exists.
-
remoteTransactionCommitted
public void remoteTransactionCommitted(GlobalTransaction gtx, boolean onePc)
Removes theRemoteTransaction
corresponding to the given tx.
-
removeRemoteTransaction
public final RemoteTransaction removeRemoteTransaction(GlobalTransaction txId)
-
getRemoteTxCount
public int getRemoteTxCount()
-
getLocalTxCount
public int getLocalTxCount()
-
getLocalTransaction
public LocalTransaction getLocalTransaction(GlobalTransaction txId)
Looks up a LocalTransaction given a GlobalTransaction.- Parameters:
txId
- the global transaction identifier- Returns:
- the LocalTransaction or null if not found
-
containsLocalTx
public boolean containsLocalTx(GlobalTransaction globalTransaction)
-
getLocalTransaction
public LocalTransaction getLocalTransaction(Transaction tx)
-
containRemoteTx
public boolean containRemoteTx(GlobalTransaction globalTransaction)
-
getRemoteTransactions
public Collection<RemoteTransaction> getRemoteTransactions()
-
getLocalTransactions
public Collection<LocalTransaction> getLocalTransactions()
-
recalculateMinTopologyIdIfNeeded
protected final void recalculateMinTopologyIdIfNeeded(CacheTransaction removedTransaction)
-
onTopologyChange
public void onTopologyChange(TopologyChangedEvent<?,?> tce)
-
onViewChange
public void onViewChange(ViewChangedEvent e)
-
markTransactionCompleted
public 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. 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
public boolean isTransactionCompleted(GlobalTransaction gtx)
-
getCompletedTransactionStatus
public TransactionTable.CompletedTransactionStatus getCompletedTransactionStatus(GlobalTransaction gtx)
-
beforeCompletion
public int beforeCompletion(LocalTransaction localTransaction)
-
afterCompletion
public void afterCompletion(LocalTransaction localTransaction, int status)
-
releaseLocksForCompletedTransaction
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase)
-
-