com.sleepycat.je.txn
Class TxnManager

java.lang.Object
  extended by com.sleepycat.je.txn.TxnManager

public class TxnManager
extends java.lang.Object

Class to manage transactions. Basically a Set of all transactions with add and remove methods and a latch around the set.


Constructor Summary
TxnManager(EnvironmentImpl envImpl)
           
 
Method Summary
 boolean areOtherSerializableTransactionsActive(Locker excludeLocker)
          Returns whether there are any active serializable transactions, excluding the transaction given (if non-null).
 long getFirstActiveLsn()
          Get the earliest LSN of all the active transactions, for checkpoint.
 long getLastLocalTxnId()
          Get the last used id, for checkpoint info.
 long getLastReplicatedTxnId()
           
 LockManager getLockManager()
          Give transactions and environment access to lock manager.
 long getNextReplicatedTxnId()
           
 Transaction getTxnForThread()
          Retrieve a Txn object for this Thread.
 Txn getTxnFromXid(javax.transaction.xa.Xid xid)
          Retrieve a Txn object from an Xid.
 LockStats lockStat(StatsConfig config)
          Collect lock related stats.
 void notePrepare()
          Called when XATransaction is prepared.
 void registerXATxn(javax.transaction.xa.Xid xid, Txn txn, boolean isPrepare)
          Called when txn is created.
 void setLastTxnId(long lastReplicatedTxnId, long lastLocalId)
          Set the txn id sequence.
 void setTxnForThread(Transaction txn)
          Called when txn is assoc'd with this thread.
 Txn txnBegin(Transaction parent, TransactionConfig txnConfig)
          Create a new transaction.
 TransactionStats txnStat(StatsConfig config)
          Collect transaction related stats.
 Transaction unsetTxnForThread()
          Called when txn is assoc'd with this thread.
 void updateFromReplay(long replayTxnId)
           
 javax.transaction.xa.Xid[] XARecover()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TxnManager

public TxnManager(EnvironmentImpl envImpl)
           throws DatabaseException
Throws:
DatabaseException
Method Detail

setLastTxnId

public void setLastTxnId(long lastReplicatedTxnId,
                         long lastLocalId)
Set the txn id sequence.


getLastLocalTxnId

public long getLastLocalTxnId()
Get the last used id, for checkpoint info.


getLastReplicatedTxnId

public long getLastReplicatedTxnId()

getNextReplicatedTxnId

public long getNextReplicatedTxnId()

updateFromReplay

public void updateFromReplay(long replayTxnId)

txnBegin

public Txn txnBegin(Transaction parent,
                    TransactionConfig txnConfig)
             throws DatabaseException
Create a new transaction.

Parameters:
parent - for nested transactions, not yet supported
txnConfig - specifies txn attributes
Returns:
the new txn
Throws:
DatabaseException

getLockManager

public LockManager getLockManager()
Give transactions and environment access to lock manager.


registerXATxn

public void registerXATxn(javax.transaction.xa.Xid xid,
                          Txn txn,
                          boolean isPrepare)
                   throws DatabaseException
Called when txn is created.

Throws:
DatabaseException

notePrepare

public void notePrepare()
Called when XATransaction is prepared.


getTxnFromXid

public Txn getTxnFromXid(javax.transaction.xa.Xid xid)
                  throws DatabaseException
Retrieve a Txn object from an Xid.

Throws:
DatabaseException

setTxnForThread

public void setTxnForThread(Transaction txn)
Called when txn is assoc'd with this thread.


unsetTxnForThread

public Transaction unsetTxnForThread()
                              throws DatabaseException
Called when txn is assoc'd with this thread.

Throws:
DatabaseException

getTxnForThread

public Transaction getTxnForThread()
                            throws DatabaseException
Retrieve a Txn object for this Thread.

Throws:
DatabaseException

XARecover

public javax.transaction.xa.Xid[] XARecover()
                                     throws DatabaseException
Throws:
DatabaseException

areOtherSerializableTransactionsActive

public boolean areOtherSerializableTransactionsActive(Locker excludeLocker)
Returns whether there are any active serializable transactions, excluding the transaction given (if non-null). This is intentionally returned without latching, since latching would not make the act of reading an integer more atomic than it already is.


getFirstActiveLsn

public long getFirstActiveLsn()
                       throws DatabaseException
Get the earliest LSN of all the active transactions, for checkpoint. Returns NULL_LSN is no transaction is currently active.

Throws:
DatabaseException

txnStat

public TransactionStats txnStat(StatsConfig config)
                         throws DatabaseException
Collect transaction related stats.

Throws:
DatabaseException

lockStat

public LockStats lockStat(StatsConfig config)
                   throws DatabaseException
Collect lock related stats.

Throws:
DatabaseException