DbLock
import com.sleepycat.db.*;
public DbLock()
throws DbException;
public DbLock(DbLock that)
throws DbException;
public DbLock(int lockid);
throws DbException;
public native void put(DbLockTab locktab)
throws DbException;
public native int get_lock_id()
throws DbException;
public native void set_lock_id(int lockid)
throws DbException;
DESCRIPTION
The DB library is a family of classes that provides a
modular programming interface to transactions and record-
oriented file access. The library includes support for
transactions, locking, logging and file page caching, as
well as various indexed access methods. Many of the
classes (e.g., the file page caching class) are useful
independent of the other DB classes, although some classes
are explicitly based on other classes (e.g., transactions
and logging). For a general description of the DB
package, see db_intro(3).
This manual page describes the specific details of the
locking interface. The DbLock class is used in
conjunction with DbLockTab(3) to provide general-purpose
locking. While designed to work with the other Db
classes, these classes are also useful for more general
locking purposes. Locks can be shared between processes.
In most cases, when multiple threads or processes are
using locking, the deadlock detector, db_deadlock(1),
should be run.
DbLock.put
The DbLock.put method releases a lock, previously obtained
from the specified DbLockTab using DbLockTab.get.
DbLock.get_lock_id
The DbLock.get_lock_id method gets the underlying
representation of the lock id. Direct manipulation of the
underlying representation is not recommended.
DbLock.set_lock_id
The DbLock.set_lock_id method sets the underlying
representation of the lock id. Direct manipulation of the
underlying representation is not recommended. Rather,
DbLockTab.get should be used to initialize locks (see
DbLockTab(3)), and the copy constructor can be used to
create new DbLock objects from existing ones.
ERRORS
The DbLock.put method may fail and throw a DbException(3)
for any of the errors specified for the following DB and
library functions: DbLock.detect(3), fcntl(2), fflush(3),
lseek(2), memcpy(3), memset(3), mmap(2), munmap(2),
strerror(3), and write(2).
In addition, the DbLock.put method may fail and throw a
DbException(3) encapsulating an errno for the following
conditions:
[EACCES]
An attempt was made to release lock held by another
locker.
[EINVAL]
An invalid flag value or parameter was specified.
BUGS
If a process dies while holding locks, those locks remain
held and are never released. In this case, all processes
should exit as quickly as possible, so that db_recover can
be run.
SEE ALSO
db_archive(1), db_checkpoint(1), db_deadlock(1), db_dump(1),
db_load(1), db_recover(1), db_stat(1), db_intro(3),
db_internal(3), db_thread(3), Db(3), Dbc(3), DbEnv(3),
DbException(3), DbInfo(3), DbLock(3), DbLockTab(3), DbLog(3),
DbLsn(3), DbMpool(3), Dbt(3), DbTxn(3), DbTxnMgr(3)
Man(1) output converted with
man2html