|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.bdb.CurrentTransaction
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.
Method Summary | |
DbTxn |
abortTxn()
Aborts the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. |
DbTxn |
beginTxn()
Begins a new transaction for this environment and associates it with the current thread. |
DbTxn |
beginTxn(boolean dirtyRead,
boolean noWait)
Begins a new transaction for this environment and associates it with the current thread. |
DbTxn |
commitTxn()
Commits the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. |
DbEnv |
getEnv()
Returns the underlying Berkeley DB environment. |
static CurrentTransaction |
getInstance(DbEnv env)
Gets the CurrentTransaction accessor for a specified Berkeley DB environment. |
DbTxn |
getTxn()
Returns the transaction associated with the current thread for this environment, or null if no transaction is active. |
boolean |
isAutoCommit()
Returns whether AUTO_COMMIT will be used for all non-cursor write operations when no transaction is active. |
boolean |
isDirtyRead()
Returns whether dirty-read is used for the current transaction. |
boolean |
isNoWait()
Returns whether no-wait is used for the current transaction. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static CurrentTransaction getInstance(DbEnv env)
env
- is an open Berkeley DB environment.
public final DbEnv getEnv()
public final boolean isAutoCommit()
public final boolean isDirtyRead()
public final boolean isNoWait()
public final DbTxn getTxn()
public final DbTxn beginTxn() throws DbException
DbException
- if the transaction cannot be started, in which case
any existing transaction is not affected.public final DbTxn beginTxn(boolean dirtyRead, boolean noWait) throws DbException
dirtyRead
- true if this transaction should read data that is
modified by another transaction but not committed.noWait
- true if this transaction should throw
DbLockNotGrantedException instead of blocking when trying to access data
that is locked by another transaction.
DbException
- if the transaction cannot be started, in which case
any existing transaction is not affected.public final DbTxn commitTxn() throws DbException, IllegalStateException
DbException
- if an error occurs commiting 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 environement.public final DbTxn abortTxn() throws DbException, IllegalStateException
DbException
- 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 environement.
|
Berkeley DB version 4.2.52 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |