org.jboss.cache.transaction
Class TransactionTable

java.lang.Object
  extended by org.jboss.cache.transaction.TransactionTable

public class TransactionTable
extends Object

Maintains the mapping between a local Transaction and a GlobalTransaction. Also stores TransactionEntry instances under a given transaction.

Version:
$Revision: 5190 $
Author:
Bela Ban Apr 14, 2003

Field Summary
protected  Map<Transaction,GlobalTransaction> tx_map
          Mapping between local (javax.transaction.Transaction) and GlobalTransactions.
protected  Map<GlobalTransaction,TransactionEntry> txs
          Mappings between GlobalTransactions and modifications.
 
Constructor Summary
TransactionTable()
           
 
Method Summary
 void addCacheLoaderModification(GlobalTransaction gtx, MethodCall m)
           
 void addLock(GlobalTransaction gtx, NodeLock l)
          Adds a lock to the global transaction.
 void addLocks(GlobalTransaction gtx, Collection<NodeLock> locks)
          Adds a collection of locks to the global transaction.
 void addModification(GlobalTransaction gtx, MethodCall m)
          Adds a motification to the global transaction.
 void addUndoOperation(GlobalTransaction gtx, MethodCall m)
          Adds an undo operation to the global transaction.
 void cleanup(GlobalTransaction gtx)
           
 TransactionEntry get(GlobalTransaction gtx)
          Returns the local transaction entry for the global transaction.
 GlobalTransaction get(Transaction tx)
          Returns the global transaction associated with the local transaction.
 Transaction getLocalTransaction(GlobalTransaction gtx)
          Returns the local transaction associated with a GlobalTransaction.
 int getNumGlobalTransactions()
          Returns the number of global transactions.
 int getNumLocalTransactions()
          Returns the number of local transactions.
 boolean isNodeRemovedInTx(GlobalTransaction gtx, Fqn fqn)
           
 void put(GlobalTransaction tx, TransactionEntry entry)
          Associates the global transaction with a transaction entry.
 void put(Transaction tx, GlobalTransaction gtx)
          Associates the global transaction with the local transaction.
 void recordNodeLock(GlobalTransaction gtx, NodeLock lock)
          Add the lock to the list of locks maintained for this transaction (needed for release of locks on commit or rollback)
 TransactionEntry remove(GlobalTransaction tx)
          Removes a global transation, returns the old transaction entry.
 GlobalTransaction remove(Transaction tx)
          Removes a local transation, returns the global transaction entry.
 String toString()
          Returns summary debug information.
 String toString(boolean print_details)
          Returns detailed debug information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tx_map

protected Map<Transaction,GlobalTransaction> tx_map
Mapping between local (javax.transaction.Transaction) and GlobalTransactions. New: a local TX can have a number of GTXs


txs

protected Map<GlobalTransaction,TransactionEntry> txs
Mappings between GlobalTransactions and modifications.

Constructor Detail

TransactionTable

public TransactionTable()
Method Detail

getNumLocalTransactions

public int getNumLocalTransactions()
Returns the number of local transactions.


getNumGlobalTransactions

public int getNumGlobalTransactions()
Returns the number of global transactions.


get

public GlobalTransaction get(Transaction tx)
Returns the global transaction associated with the local transaction. Returns null if tx is null or it was not found.


getLocalTransaction

public Transaction getLocalTransaction(GlobalTransaction gtx)
Returns the local transaction associated with a GlobalTransaction. Not very efficient as the values have to be iterated over, don't use frequently

Parameters:
gtx - The GlobalTransaction
Returns:
Transaction. The local transaction associated with a given GlobalTransaction). This will be null if no local transaction is associated with a given GTX

put

public void put(Transaction tx,
                GlobalTransaction gtx)
Associates the global transaction with the local transaction.


get

public TransactionEntry get(GlobalTransaction gtx)
Returns the local transaction entry for the global transaction. Returns null if tx is null or it was not found.


put

public void put(GlobalTransaction tx,
                TransactionEntry entry)
Associates the global transaction with a transaction entry.


remove

public TransactionEntry remove(GlobalTransaction tx)
Removes a global transation, returns the old transaction entry.


remove

public GlobalTransaction remove(Transaction tx)
Removes a local transation, returns the global transaction entry.


addModification

public void addModification(GlobalTransaction gtx,
                            MethodCall m)
Adds a motification to the global transaction.


addCacheLoaderModification

public void addCacheLoaderModification(GlobalTransaction gtx,
                                       MethodCall m)

addUndoOperation

public void addUndoOperation(GlobalTransaction gtx,
                             MethodCall m)
Adds an undo operation to the global transaction.


addLock

public void addLock(GlobalTransaction gtx,
                    NodeLock l)
Adds a lock to the global transaction.


addLocks

public void addLocks(GlobalTransaction gtx,
                     Collection<NodeLock> locks)
Adds a collection of locks to the global transaction.


cleanup

public void cleanup(GlobalTransaction gtx)

toString

public String toString()
Returns summary debug information.

Overrides:
toString in class Object

toString

public String toString(boolean print_details)
Returns detailed debug information.


recordNodeLock

public void recordNodeLock(GlobalTransaction gtx,
                           NodeLock lock)
Add the lock to the list of locks maintained for this transaction (needed for release of locks on commit or rollback)


isNodeRemovedInTx

public boolean isNodeRemovedInTx(GlobalTransaction gtx,
                                 Fqn fqn)


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