Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

com::sleepycat::collections::CurrentTransaction Class Reference


Public Member Functions

final Environment getEnvironment ()
final Transaction getTransaction ()
final Transaction beginTransaction (TransactionConfig config) throws DatabaseException
final Transaction commitTransaction () throws DatabaseException, IllegalStateException
final Transaction abortTransaction () throws DatabaseException, IllegalStateException

Static Public Member Functions

static CurrentTransaction getInstance (Environment env)

Package Functions

final boolean isTxnMode ()
final boolean isCdbMode ()
final LockMode getWriteLockMode ()
boolean isAutoCommitAllowed () throws DatabaseException
final boolean isReadUncommitted ()
Cursor openCursor (Database db, CursorConfig cursorConfig, boolean writeCursor, Transaction txn) throws DatabaseException
Cursor dupCursor (Cursor cursor, boolean writeCursor, boolean samePosition) throws DatabaseException
void closeCursor (Cursor cursor) throws DatabaseException
boolean isCDBCursorOpen (Database db) throws DatabaseException

Static Package Functions

static CurrentTransaction getInstanceInternal (Environment env)

Detailed Description

Provides access to the current transaction for the current thread within the context of a Berkeley DB environment. This class provides explicit transaction control beyond that provided by the TransactionRunner class. However, both methods of transaction control manage per-thread transactions.

Author:
Mark Hayes

Definition at line 37 of file CurrentTransaction.java.


Member Function Documentation

final Transaction com::sleepycat::collections::CurrentTransaction::abortTransaction  )  throws DatabaseException, IllegalStateException [inline]
 

Aborts the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction.

Returns:
the parent transaction or null if the aborted transaction was not nested.
Exceptions:
DatabaseException if an error occurs aborting the transaction. The transaction will still be closed and the parent transaction will become the current transaction.
IllegalStateException if no transaction is active for the current thread for this environment.

Definition at line 245 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::TransactionRunner::run().

final Transaction com::sleepycat::collections::CurrentTransaction::beginTransaction TransactionConfig  config  )  throws DatabaseException [inline]
 

Begins a new transaction for this environment and associates it with the current thread. If a transaction is already active for this environment and thread, a nested transaction will be created.

Parameters:
config the transaction configuration used for calling Environment#beginTransaction, or null to use the default configuration.
Returns:
the new transaction.
Exceptions:
DatabaseException if the transaction cannot be started, in which case any existing transaction is not affected.
IllegalStateException if a transaction is already active and nested transactions are not supported by the environment.

Definition at line 176 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::TransactionRunner::run().

void com::sleepycat::collections::CurrentTransaction::closeCursor Cursor  cursor  )  throws DatabaseException [inline, package]
 

Closes a cursor.

Parameters:
cursor the cursor to close.
Exceptions:
DatabaseException if a database problem occurs.

Definition at line 397 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataCursor::close().

final Transaction com::sleepycat::collections::CurrentTransaction::commitTransaction  )  throws DatabaseException, IllegalStateException [inline]
 

Commits the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction.

Returns:
the parent transaction or null if the committed transaction was not nested.
Exceptions:
DatabaseException if an error occurs committing the transaction. The transaction will still be closed and the parent transaction will become the current transaction.
IllegalStateException if no transaction is active for the current thread for this environment.

Definition at line 217 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::TransactionRunner::run().

Cursor com::sleepycat::collections::CurrentTransaction::dupCursor Cursor  cursor,
boolean  writeCursor,
boolean  samePosition
throws DatabaseException [inline, package]
 

Duplicates a cursor for a given database.

Parameters:
writeCursor true to open a write cursor in a CDB environment, and ignored for other environments.
samePosition is passed through to Cursor.dup().
Returns:
the open cursor.
Exceptions:
DatabaseException if a database problem occurs.

Definition at line 366 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::RangeCursor::dup().

final Environment com::sleepycat::collections::CurrentTransaction::getEnvironment  )  [inline]
 

Returns the underlying Berkeley DB environment.

Definition at line 132 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataView::getEnv().

static CurrentTransaction com::sleepycat::collections::CurrentTransaction::getInstance Environment  env  )  [inline, static]
 

Gets the CurrentTransaction accessor for a specified Berkeley DB environment. This method always returns the same reference when called more than once with the same environment parameter.

Parameters:
env is an open Berkeley DB environment.
Returns:
the CurrentTransaction accessor for the given environment, or null if the environment is not transactional.

Definition at line 60 of file CurrentTransaction.java.

References getInstanceInternal(), and isTxnMode().

static CurrentTransaction com::sleepycat::collections::CurrentTransaction::getInstanceInternal Environment  env  )  [inline, static, package]
 

Gets the CurrentTransaction accessor for a specified Berkeley DB environment. Unlike getInstance(), this method never returns null.

Parameters:
env is an open Berkeley DB environment.

Definition at line 72 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataView::DataView(), and getInstance().

final Transaction com::sleepycat::collections::CurrentTransaction::getTransaction  )  [inline]
 

Returns the transaction associated with the current thread for this environment, or null if no transaction is active.

Definition at line 141 of file CurrentTransaction.java.

Referenced by isAutoCommitAllowed(), com::sleepycat::collections::TransactionRunner::run(), and com::sleepycat::collections::DataView::useTransaction().

final LockMode com::sleepycat::collections::CurrentTransaction::getWriteLockMode  )  [inline, package]
 

Return the LockMode.RMW or null, depending on whether locking is enabled. LockMode.RMW will cause an error if passed when locking is not enabled. Locking is enabled if locking or transactions were specified for this environment.

Definition at line 124 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataCursor::getLockMode().

boolean com::sleepycat::collections::CurrentTransaction::isAutoCommitAllowed  )  throws DatabaseException [inline, package]
 

Returns whether auto-commit may be performed by the collections API. True is returned no collections API transaction is currently active, and no XA transaction is currently active.

Definition at line 152 of file CurrentTransaction.java.

References getTransaction().

boolean com::sleepycat::collections::CurrentTransaction::isCDBCursorOpen Database  db  )  throws DatabaseException [inline, package]
 

Returns true if a CDB cursor is open and therefore a Database write operation should not be attempted since a self-deadlock may result.

Definition at line 427 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataView::append().

final boolean com::sleepycat::collections::CurrentTransaction::isCdbMode  )  [inline, package]
 

Returns whether this is a Concurrent Data Store environment.

Definition at line 113 of file CurrentTransaction.java.

final boolean com::sleepycat::collections::CurrentTransaction::isReadUncommitted  )  [inline, package]
 

Returns whether the current transaction is a readUncommitted transaction.

Definition at line 262 of file CurrentTransaction.java.

final boolean com::sleepycat::collections::CurrentTransaction::isTxnMode  )  [inline, package]
 

Returns whether this is a transactional environment.

Definition at line 105 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::DataView::DataView(), and getInstance().

Cursor com::sleepycat::collections::CurrentTransaction::openCursor Database  db,
CursorConfig  cursorConfig,
boolean  writeCursor,
Transaction  txn
throws DatabaseException [inline, package]
 

Opens a cursor for a given database, dup'ing an existing CDB cursor if one is open for the current thread.

Definition at line 295 of file CurrentTransaction.java.

Referenced by com::sleepycat::collections::RangeCursor::RangeCursor().


The documentation for this class was generated from the following file:
Generated on Sun Dec 25 12:15:00 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2