# DbTxn.set_timeout |

`

###

    import com.sleepycat.db.*;

    public int set_timeout(long timeout, int flags)
        throws DbException;

# Description

The DbTxn.set_timeout method sets timeout values for locks or transactions for the specified transaction. The timeout value is currently specified as an unsigned 32-bit number of microseconds, limiting the maximum timeout to roughly 71 minutes.

The flags value must be set to one of the following values:

Db.DB_SET_LOCK_TIMEOUT
  Set the timeout value for locks in this transaction.

Db.DB_SET_TXN_TIMEOUT
  Set the timeout value for this transaction.

Timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. (In the case of Db.DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly through the Lock subsystem interfaces. In the case of Db.DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a transaction. In either case, it may be a lock requested by the database access methods underlying the application.) As timeouts are only checked when the lock request first blocks or when deadlock detection is performed, the accuracy of the timeout depends on how often deadlock detection is performed.

Timeout values may be specified for the database environment as a whole. See DbEnv.set_timeout and for more information.

The DbTxn.set_timeout method throws an exception that encapsulates a non-zero error value on failure.

# Errors

The DbTxn.set_timeout method may fail and throw an exception encapsulating a non-zero error for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

The DbTxn.set_timeout method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbTxn.set_timeout method may fail and throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

# Class

DbEnv, DbTxn

# See Also

DbEnv.set_tx_max, DbEnv.set_tx_timestamp, DbTxn.abort, DbEnv.txn_begin, DbEnv.txn_checkpoint, DbTxn.commit, DbTxn.discard, DbTxn.id, DbTxn.prepare, DbEnv.txn_recover, DbTxn.set_timeout and DbEnv.txn_stat.`

Copyright Sleepycat Software