Infinispan Distribution 5.2.6.Final-redhat-2

org.infinispan.transaction
Class TransactionTable

java.lang.Object
  extended by org.infinispan.transaction.TransactionTable
Direct Known Subclasses:
XaTransactionTable

public class TransactionTable
extends Object

Repository for RemoteTransaction and TransactionXaAdapters (locally originated transactions).

Since:
4.0
Author:
Mircea.Markus@jboss.com, Galder ZamarreƱo

Field Summary
static int CACHE_STOPPED_TOPOLOGY_ID
           
protected  boolean clustered
           
protected  ClusteringDependentLogic clusteringLogic
           
protected  CommandsFactory commandsFactory
           
protected  Configuration configuration
           
protected  InvocationContextContainer icc
           
protected  RpcManager rpcManager
           
protected  TransactionCoordinator txCoordinator
           
protected  TransactionFactory txFactory
           
 
Constructor Summary
TransactionTable()
           
 
Method Summary
 void cleanupCompletedTransactions()
           
 void cleanupStaleTransactions(CacheTopology cacheTopology)
           
 boolean containRemoteTx(GlobalTransaction globalTransaction)
           
 boolean containsLocalTx(Transaction tx)
          Returns true if the given transaction is already registered with the transaction table.
 void enlist(Transaction transaction, LocalTransaction localTransaction)
           
 void failureCompletingTransaction(Transaction tx)
           
 LocalTransaction getLocalTransaction(GlobalTransaction txId)
          Looks up a LocalTransaction given a GlobalTransaction.
 LocalTransaction getLocalTransaction(Transaction tx)
           
 Collection<LocalTransaction> getLocalTransactions()
           
 int getLocalTxCount()
           
 Set<Object> getLockedKeysForRemoteTransaction(GlobalTransaction gtx)
           
 int getMinTopologyId()
           
 LocalTransaction getOrCreateLocalTransaction(Transaction transaction, TxInvocationContext ctx)
          Returns the TransactionXaAdapter corresponding to the supplied transaction.
 RemoteTransaction getOrCreateRemoteTransaction(GlobalTransaction globalTx, WriteCommand[] modifications)
          Returns an existing remote transaction or creates one if none exists.
 RemoteTransaction getRemoteTransaction(GlobalTransaction txId)
          Returns the RemoteTransaction associated with the supplied transaction id.
 Collection<RemoteTransaction> getRemoteTransactions()
           
 int getRemoteTxCount()
           
 void initialize(RpcManager rpcManager, Configuration configuration, InvocationContextContainer icc, InterceptorChain invoker, CacheNotifier notifier, TransactionFactory gtf, TransactionCoordinator txCoordinator, TransactionSynchronizationRegistry transactionSynchronizationRegistry, CommandsFactory commandsFactory, ClusteringDependentLogic clusteringDependentLogic, Cache cache)
           
 boolean isTransactionCompleted(GlobalTransaction gtx)
           
 void localTransactionPrepared(LocalTransaction localTransaction)
           
 void markTransactionCompleted(GlobalTransaction globalTx)
          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)
           
protected  void recalculateMinTopologyIdIfNeeded(CacheTransaction removedTransaction)
           
 void remoteTransactionCommitted(GlobalTransaction gtx)
          Removes the RemoteTransaction corresponding to the given tx.
 void remoteTransactionPrepared(GlobalTransaction gtx)
           
 void remoteTransactionRollback(GlobalTransaction gtx)
           
 boolean removeLocalTransaction(LocalTransaction localTransaction)
          Removes the TransactionXaAdapter corresponding to the given tx.
protected  LocalTransaction removeLocalTransactionInternal(Transaction tx)
           
 RemoteTransaction removeRemoteTransaction(GlobalTransaction txId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHE_STOPPED_TOPOLOGY_ID

public static final int CACHE_STOPPED_TOPOLOGY_ID
See Also:
Constant Field Values

configuration

protected Configuration configuration

icc

protected InvocationContextContainer icc

txCoordinator

protected TransactionCoordinator txCoordinator

txFactory

protected TransactionFactory txFactory

rpcManager

protected RpcManager rpcManager

commandsFactory

protected CommandsFactory commandsFactory

clusteringLogic

protected ClusteringDependentLogic clusteringLogic

clustered

protected boolean clustered
Constructor Detail

TransactionTable

public TransactionTable()
Method Detail

initialize

public void initialize(RpcManager rpcManager,
                       Configuration configuration,
                       InvocationContextContainer icc,
                       InterceptorChain invoker,
                       CacheNotifier notifier,
                       TransactionFactory gtf,
                       TransactionCoordinator txCoordinator,
                       TransactionSynchronizationRegistry transactionSynchronizationRegistry,
                       CommandsFactory commandsFactory,
                       ClusteringDependentLogic clusteringDependentLogic,
                       Cache cache)

getLockedKeysForRemoteTransaction

public Set<Object> getLockedKeysForRemoteTransaction(GlobalTransaction gtx)

remoteTransactionPrepared

public void remoteTransactionPrepared(GlobalTransaction gtx)

localTransactionPrepared

public void localTransactionPrepared(LocalTransaction localTransaction)

enlist

public void enlist(Transaction transaction,
                   LocalTransaction localTransaction)

failureCompletingTransaction

public void failureCompletingTransaction(Transaction tx)

containsLocalTx

public boolean containsLocalTx(Transaction tx)
Returns true if the given transaction is already registered with the transaction table.

Parameters:
tx - if null false is returned

getMinTopologyId

public int getMinTopologyId()

cleanupStaleTransactions

public void cleanupStaleTransactions(CacheTopology cacheTopology)

getRemoteTransaction

public RemoteTransaction getRemoteTransaction(GlobalTransaction txId)
Returns the RemoteTransaction 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,
                                                      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,
                                                    TxInvocationContext ctx)
Returns the TransactionXaAdapter corresponding to the supplied transaction. If none exists, will be created first.


removeLocalTransaction

public boolean removeLocalTransaction(LocalTransaction localTransaction)
Removes the TransactionXaAdapter corresponding to the given tx. Returns true if such an tx exists.


removeLocalTransactionInternal

protected final LocalTransaction removeLocalTransactionInternal(Transaction tx)

remoteTransactionCommitted

public void remoteTransactionCommitted(GlobalTransaction gtx)
Removes the RemoteTransaction 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

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)

markTransactionCompleted

public void markTransactionCompleted(GlobalTransaction globalTx)
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)
See Also:
markTransactionCompleted(org.infinispan.transaction.xa.GlobalTransaction)

cleanupCompletedTransactions

public void cleanupCompletedTransactions()

Infinispan Distribution 5.2.6.Final-redhat-2

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.