net.sf.farrago.db
Class FarragoDbNullTxnMgr

java.lang.Object
  extended by net.sf.farrago.db.FarragoDbNullTxnMgr
All Implemented Interfaces:
FarragoSessionTxnMgr
Direct Known Subclasses:
LucidDbTxnMgr

public class FarragoDbNullTxnMgr
extends Object
implements FarragoSessionTxnMgr

FarragoDbNullTxnMgr is a do-nothing implementation of FarragoSessionTxnMgr. It is useful as a base class because it has a default implementation for generating new transaction ID's and notifying listeners.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/db/FarragoDbNullTxnMgr.java#7 $
Author:
John V. Sichi

Nested Class Summary
private static class FarragoDbNullTxnMgr.LongTxnId
           
 
Field Summary
private  List<FarragoSessionTxnListener> listeners
           
private  AtomicLong nextId
           
 
Constructor Summary
FarragoDbNullTxnMgr()
           
 
Method Summary
protected  void accessTable(FarragoSessionTxnId txnId, List<String> localTableName, TableAccessMap.Mode accessType)
          Called by accessTables for each table accessed.
private  void accessTablePrivate(FarragoSessionTxnId txnId, List<String> localTableName, TableAccessMap.Mode accessType)
           
 void accessTables(FarragoSessionTxnId txnId, TableAccessMap accessMap)
          Notifies transaction manager that a collection of tables is about to be accessed.
 void addListener(FarragoSessionTxnListener listener)
          Adds a listener for transaction events.
 FarragoSessionTxnId beginTxn(FarragoSession session)
          Begins a new transaction.
 void endTxn(FarragoSessionTxnId txnId, FarragoSessionTxnEnd endType)
          Notifies transaction manager that a transaction is ending.
 void removeListener(FarragoSessionTxnListener listener)
          Removes a listener for transaction events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextId

private final AtomicLong nextId

listeners

private final List<FarragoSessionTxnListener> listeners
Constructor Detail

FarragoDbNullTxnMgr

public FarragoDbNullTxnMgr()
Method Detail

addListener

public void addListener(FarragoSessionTxnListener listener)
Description copied from interface: FarragoSessionTxnMgr
Adds a listener for transaction events.

Specified by:
addListener in interface FarragoSessionTxnMgr
Parameters:
listener - new listener

removeListener

public void removeListener(FarragoSessionTxnListener listener)
Description copied from interface: FarragoSessionTxnMgr
Removes a listener for transaction events.

Specified by:
removeListener in interface FarragoSessionTxnMgr
Parameters:
listener - listener to remove

beginTxn

public FarragoSessionTxnId beginTxn(FarragoSession session)
Description copied from interface: FarragoSessionTxnMgr
Begins a new transaction.

Specified by:
beginTxn in interface FarragoSessionTxnMgr
Parameters:
session - session initiating the transaction
Returns:
transaction ID

accessTables

public void accessTables(FarragoSessionTxnId txnId,
                         TableAccessMap accessMap)
Description copied from interface: FarragoSessionTxnMgr
Notifies transaction manager that a collection of tables is about to be accessed.

Specified by:
accessTables in interface FarragoSessionTxnMgr
Parameters:
txnId - ID of accessing transaction
accessMap - information about planned table accesses

accessTablePrivate

private void accessTablePrivate(FarragoSessionTxnId txnId,
                                List<String> localTableName,
                                TableAccessMap.Mode accessType)

accessTable

protected void accessTable(FarragoSessionTxnId txnId,
                           List<String> localTableName,
                           TableAccessMap.Mode accessType)
Called by accessTables for each table accessed. Default implementation is to do nothing; subclasses override this to take real actions such as calling a lock manager.

Parameters:
txnId - ID of accessing transaction
localTableName - qualified name of table as it is known in the local catalog
accessType - type of table access

endTxn

public void endTxn(FarragoSessionTxnId txnId,
                   FarragoSessionTxnEnd endType)
Description copied from interface: FarragoSessionTxnMgr
Notifies transaction manager that a transaction is ending.

Specified by:
endTxn in interface FarragoSessionTxnMgr
Parameters:
txnId - ID of ending transaction
endType - how transaction is ending