|
Berkeley DB Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sleepycat.je.Transaction
An environment transaction.
To obtain a transaction with default attributes:
To customize the attributes of a transaction:Transaction txn = myEnvironment.beginTransaction(null, null);
TransactionConfig config = new TransactionConfig(); config.setDirtyRead(true); Transaction txn = myEnvironment.beginTransaction(null, config);
Method Summary | |
void |
abort()
Cause an abnormal termination of the transaction. |
void |
commit()
End the transaction, synchronously committing if the database environment is configured for synchronous commit. |
void |
commitNoSync()
End the transaction, not committing synchronously. |
void |
commitSync()
End the transaction, committing synchronously. |
String |
getName()
Get the user visible name for the transaction. |
void |
setLockTimeout(long timeOut)
Configure the lock request timeout value for the transaction. |
void |
setName(String name)
Set the user visible name for the transaction. |
void |
setTxnTimeout(long timeOut)
Configure the timeout value for the transaction. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void abort() throws DatabaseException
The log is played backward, and any necessary undo operations are done. Before Transaction.abort returns, any locks held by the transaction will have been released.
In the case of nested transactions, aborting a parent transaction causes all children (unresolved or not) of the parent transaction to be aborted.
All cursors opened within the transaction must be closed before the transaction is aborted.
After Transaction.abort has been called, regardless of its return, the
Transaction
handle may not be accessed again.
DatabaseException
- if a failure occurs.public void commit() throws DatabaseException
If the environment is configured for synchronous commit, the transaction will be committed synchronously to stable storage before the call returns; if the environment is configured for asynchronous commit, the commit will not necessarily have been committed to stable storage before the call returns.
In the case of nested transactions, if the transaction is a parent transaction, committing the parent transaction causes all unresolved children of the parent to be committed. In the case of nested transactions, if the transaction is a child transaction, its locks are not released, but are acquired by its parent. Although the commit of the child transaction will succeed, the actual resolution of the child transaction is postponed until the parent transaction is committed or aborted; that is, if its parent transaction commits, it will be committed; and if its parent transaction aborts, it will be aborted.
All cursors opened within the transaction must be closed before the transaction is committed.
After Transaction.commit has been called, regardless of its return, the
Transaction
handle may not be accessed again. If Transaction.commit
encounters an error, the transaction and all child transactions of
the transaction will have been aborted when the call returns.
DatabaseException
- if a failure occurs.public void commitSync() throws DatabaseException
The transaction will be committed synchronously to stable storage before the call returns.
In the case of nested transactions, if the transaction is a parent transaction, committing the parent transaction causes all unresolved children of the parent to be committed. In the case of nested transactions, if the transaction is a child transaction, its locks are not released, but are acquired by its parent. Although the commit of the child transaction will succeed, the actual resolution of the child transaction is postponed until the parent transaction is committed or aborted; that is, if its parent transaction commits, it will be committed; and if its parent transaction aborts, it will be aborted.
All cursors opened within the transaction must be closed before the transaction is committed.
After Transaction.commit has been called, regardless of its return, the
Transaction
handle may not be accessed again. If Transaction.commit
encounters an error, the transaction and all child transactions of
the transaction will have been aborted when the call returns.
DatabaseException
- if a failure occurs.public void commitNoSync() throws DatabaseException
The transaction will not necessarily have been committed to stable storage before the call returns.
In the case of nested transactions, if the transaction is a parent transaction, committing the parent transaction causes all unresolved children of the parent to be committed. In the case of nested transactions, if the transaction is a child transaction, its locks are not released, but are acquired by its parent. Although the commit of the child transaction will succeed, the actual resolution of the child transaction is postponed until the parent transaction is committed or aborted; that is, if its parent transaction commits, it will be committed; and if its parent transaction aborts, it will be aborted.
All cursors opened within the transaction must be closed before the transaction is committed.
After Transaction.commit has been called, regardless of its return, the
Transaction
handle may not be accessed again. If Transaction.commit
encounters an error, the transaction and all child transactions of
the transaction will have been aborted when the call returns.
DatabaseException
- if a failure occurs.public void setTxnTimeout(long timeOut) throws DatabaseException
If the transaction runs longer than this time, the transaction may
may throw DeadlockException
.
timeOut
- The timeout value for the transaction, in microseconds.
DatabaseException
- if a failure occurs.public void setLockTimeout(long timeOut) throws DatabaseException
If a lock request cannot be granted in this time, the transaction
may throw DeadlockException
.
timeOut
- The lock request timeout value for the transaction, in microseconds.
DatabaseException
- if a failure occurs.public void setName(String name)
name
- The user visible name for the transaction.
public String getName()
|
Berkeley DB Java Edition version 1.5.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |