116 lines
5.3 KiB
HTML
116 lines
5.3 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>DbLock</TITLE>
|
|
</HEAD>
|
|
<BODY BGCOLOR=white>
|
|
<H1>DbLock</H1>
|
|
<HR SIZE=1 NOSHADE>
|
|
<PRE>
|
|
<!-- Manpage converted by man2html 3.0.1 -->
|
|
<B>import</B> <B>com.sleepycat.db.*;</B>
|
|
|
|
<B>public</B> <B>DbLock()</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
<B>public</B> <B>DbLock(DbLock</B> <B>that)</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
<B>public</B> <B>DbLock(int</B> <B>lockid);</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
<B>public</B> <B>native</B> <B>void</B> <B>put(DbLockTab</B> <B>locktab)</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
<B>public</B> <B>native</B> <B>int</B> <B>get</B>_<B>lock</B>_<B>id()</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
<B>public</B> <B>native</B> <B>void</B> <B>set</B>_<B>lock</B>_<B>id(int</B> <B>lockid)</B>
|
|
<B>throws</B> <B>DbException;</B>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
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 <B><A HREF="db_intro.html">db_intro(3)</A></B>.
|
|
|
|
This manual page describes the specific details of the
|
|
locking interface. The DbLock class is used in
|
|
conjunction with <B><A HREF="DbLockTab.j.html">DbLockTab(3)</A></B> 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, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>,
|
|
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
|
|
<B><A HREF="DbLockTab.j.html">DbLockTab(3)</A></B>), and the copy constructor can be used to
|
|
create new DbLock objects from existing ones.
|
|
|
|
|
|
</PRE>
|
|
<H2>ERRORS</H2><PRE>
|
|
The DbLock.put method may fail and throw a <B><A HREF="DbException.j.html">DbException(3)</A></B>
|
|
for any of the errors specified for the following DB and
|
|
library functions: <B><A HREF="DbLock.j.html">DbLock.detect(3)</A></B>, <B>fcntl(2)</B>, <B>fflush(3)</B>,
|
|
<B>lseek(2)</B>, <B>memcpy(3)</B>, <B>memset(3)</B>, <B>mmap(2)</B>, <B>munmap(2)</B>,
|
|
<B>strerror(3)</B>, and <B>write(2)</B>.
|
|
|
|
In addition, the DbLock.put method may fail and throw a
|
|
<B><A HREF="DbException.j.html">DbException(3)</A></B> 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.
|
|
|
|
|
|
</PRE>
|
|
<H2>BUGS</H2><PRE>
|
|
If a process dies while holding locks, those locks remain
|
|
held and are <B>never</B> released. In this case, all processes
|
|
should exit as quickly as possible, so that db_recover can
|
|
be run.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<B><A HREF="db_archive.html">db_archive(1)</A></B>, <B><A HREF="db_checkpoint.html">db_checkpoint(1)</A></B>, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>, <B><A HREF="db_dump.html">db_dump(1)</A></B>,
|
|
<B><A HREF="db_load.html">db_load(1)</A></B>, <B><A HREF="db_recover.html">db_recover(1)</A></B>, <B><A HREF="db_stat.html">db_stat(1)</A></B>, <B><A HREF="db_intro.html">db_intro(3)</A></B>,
|
|
<B><A HREF="db_internal.html">db_internal(3)</A></B>, <B><A HREF="db_thread.html">db_thread(3)</A></B>, <B><A HREF="Db.j.html">Db(3)</A></B>, <B><A HREF="Dbc.j.html">Dbc(3)</A></B>, <B><A HREF="DbEnv.j.html">DbEnv(3)</A></B>,
|
|
<B><A HREF="DbException.j.html">DbException(3)</A></B>, <B><A HREF="DbInfo.j.html">DbInfo(3)</A></B>, <B><A HREF="DbLock.j.html">DbLock(3)</A></B>, <B><A HREF="DbLockTab.j.html">DbLockTab(3)</A></B>, <B><A HREF="DbLog.j.html">DbLog(3)</A></B>,
|
|
<B><A HREF="DbLsn.j.html">DbLsn(3)</A></B>, <B><A HREF="DbMpool.j.html">DbMpool(3)</A></B>, <B><A HREF="Dbt.j.html">Dbt(3)</A></B>, <B><A HREF="DbTxn.j.html">DbTxn(3)</A></B>, <B><A HREF="DbTxnMgr.j.html">DbTxnMgr(3)</A></B>
|
|
|
|
</PRE>
|
|
<HR SIZE=1 NOSHADE>
|
|
<ADDRESS>
|
|
Man(1) output converted with
|
|
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|