Berkeley DB: DbTxn.abort
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btr ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++

# DbTxn.abort

`

###

    import com.sleepycat.db.*;

    public void abort()
        throws DbException;

# Description

The DbTxn.abort method causes an abnormal termination of the transaction.

The log is played backwards and any necessary recovery operations are initiated through the recover function specified to DbTxnMgr.open. After recovery is completed, all locks held by the transaction are acquired by the parent transaction in the case of a nested transaction or released in the case of a non-nested transaction. As is the case for DbTxn.commit, applications that require strict two-phase locking should not explicitly release any locks.

In the case of nested transactions, aborting the parent transaction causes all children of that transaction to be aborted.

The DbTxn.abort method throws an exception that encapsulates an errno on failure.

# Errors

If a fatal error occurs in Berkeley DB, the DbTxn.abort method may fail and throw a DbRunRecoveryException, at which point all subsequent database calls will also fail in the same way.

The DbTxn.abort method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: DBenv->tx_recover, abort(3), fcntl(3), fflush(3), fprintf(3), free(3), getpid(3), DbLockTab.vec, DbLog.get, memset(3), strerror(3), vfprintf(3), and vsnprintf(3).

In addition, the DbTxn.abort method may fail and throw an exception encapsulating errno for the following conditions:

EINVAL
  The transaction was already aborted.

# Class

DbTxn

# See Also

DbTxn.abort, DbTxn.commit, DbTxn.id and DbTxn.prepare.`