org.jboss.cache
Class TransactionTable

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

public class TransactionTable
extends java.lang.Object

Maintains the mapping between local (Transaction) and global transactions (GlobalTransaction). Also keys modifications and undo-operations) under a given TX.

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

Field Summary
protected  java.util.Map tx_map
          Map, mapping between local (javax.transaction.Transaction) and GlobalTransactions.
protected  java.util.Map txs
          Map, mappings between GlobalTransactions and modifications
 
Constructor Summary
TransactionTable()
          Constructs a new table.
 
Method Summary
 void addCacheLoaderModification(GlobalTransaction gtx, org.jgroups.blocks.MethodCall m)
           
 void addLock(GlobalTransaction gtx, IdentityLock l)
          Adds a lock to the global transaction.
 void addLocks(GlobalTransaction gtx, java.util.Collection locks)
          Adds a collection of locks to the global transaction.
 void addModification(GlobalTransaction gtx, org.jgroups.blocks.MethodCall m)
          Adds a motification to the global transaction.
 void addUndoOperation(GlobalTransaction gtx, org.jgroups.blocks.MethodCall m)
          Adds an undo operation to the global transaction.
 TransactionEntry get(GlobalTransaction gtx)
          Returns the local transaction entry for the global transaction.
 GlobalTransaction get(javax.transaction.Transaction tx)
          Returns the global transaction associated with the local transaction.
 javax.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.
 void put(GlobalTransaction tx, TransactionEntry entry)
          Associates the global transaction with a transaction entry.
 void put(javax.transaction.Transaction tx, GlobalTransaction gtx)
          Associates the global transaction with the local transaction.
 TransactionEntry remove(GlobalTransaction tx)
          Removes a global transation, returns the old transaction entry.
 GlobalTransaction remove(javax.transaction.Transaction tx)
          Removes a local transation, returns the global transaction entry.
 java.lang.String toString()
          Returns summary debug information.
 java.lang.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 java.util.Map tx_map
Map, mapping between local (javax.transaction.Transaction) and GlobalTransactions. New: a local TX can have a number of GTXs


txs

protected java.util.Map txs
Map, mappings between GlobalTransactions and modifications

Constructor Detail

TransactionTable

public TransactionTable()
Constructs a new table.

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(javax.transaction.Transaction tx)
Returns the global transaction associated with the local transaction. Returns null if tx is null or it was not found.


getLocalTransaction

public javax.transaction.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(javax.transaction.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(javax.transaction.Transaction tx)
Removes a local transation, returns the global transaction entry.


addModification

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


addCacheLoaderModification

public void addCacheLoaderModification(GlobalTransaction gtx,
                                       org.jgroups.blocks.MethodCall m)

addUndoOperation

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


addLock

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


addLocks

public void addLocks(GlobalTransaction gtx,
                     java.util.Collection locks)
Adds a collection of locks to the global transaction.


toString

public java.lang.String toString()
Returns summary debug information.

Overrides:
toString in class java.lang.Object

toString

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



Copyright 1998-2005 JBoss Inc . All Rights Reserved.