704 lines
36 KiB
HTML
704 lines
36 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 31 17:36:45 EDT 2017 -->
|
|
<title>LockMode (Oracle - Berkeley DB Java Edition API)</title>
|
|
<meta name="date" content="2017-10-31">
|
|
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="LockMode (Oracle - Berkeley DB Java Edition API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":9,"i3":9};
|
|
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/LockMode.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../com/sleepycat/je/LockNotAvailableException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/je/LockMode.html" target="_top">Frames</a></li>
|
|
<li><a href="LockMode.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#enum.constant.summary">Enum Constants</a> | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#enum.constant.detail">Enum Constants</a> | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.sleepycat.je</div>
|
|
<h2 title="Enum LockMode" class="title">Enum LockMode</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>java.lang.Enum<<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>></li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.sleepycat.je.LockMode</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd>java.io.Serializable, java.lang.Comparable<<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public enum <span class="typeNameLabel">LockMode</span>
|
|
extends java.lang.Enum<<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>></pre>
|
|
<div class="block">Record lock modes for read operations. Lock mode parameters may be specified
|
|
for all operations that retrieve data.
|
|
|
|
<p><strong>Locking Rules</strong></p>
|
|
|
|
<p>Together with <a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je"><code>CursorConfig</code></a>, <a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je"><code>TransactionConfig</code></a> and <a href="../../../com/sleepycat/je/EnvironmentConfig.html" title="class in com.sleepycat.je"><code>EnvironmentConfig</code></a> settings, lock mode parameters determine how records are
|
|
locked during read operations. Record locking is used to enforce the
|
|
isolation modes that are configured. Record locking is summarized below for
|
|
read and write operations. For more information on isolation levels and
|
|
transactions, see <a
|
|
href="../../../../TransactionGettingStarted/index.html"
|
|
target="_top">Writing Transactional Applications</a>.</p>
|
|
|
|
<p>With one exception, a record lock is always acquired when a record is
|
|
read or written, and a cursor will always hold the lock as long as it is
|
|
positioned on the record. The exception is when <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a>
|
|
is specified, which allows a record to be read without any locking.</p>
|
|
|
|
<p>Both read (shared) and write (exclusive) locks are used. Read locks are
|
|
normally acquired on read (<code>get</code> method) operations and write locks on
|
|
write (<code>put</code> method) operations. The only exception is that a write
|
|
lock will be acquired on a read operation if <a href="../../../com/sleepycat/je/LockMode.html#RMW"><code>RMW</code></a> is specified.</p>
|
|
|
|
<p>Because read locks are shared, multiple accessors may read the same
|
|
record. Because write locks are exclusive, if a record is written by one
|
|
accessor it may not be read or written by another accessor. An accessor is
|
|
either a transaction or a thread (for non-transactional operations).</p>
|
|
|
|
<p>Whether additional locking is performed and how locks are released depend
|
|
on whether the operation is transactional and other configuration
|
|
settings.</p>
|
|
|
|
<p><strong>Transactional Locking</strong></p>
|
|
|
|
<p>Transactional operations include all write operations for a transactional
|
|
database, and read operations when a non-null <a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je"><code>Transaction</code></a> parameter
|
|
is passed. When a null transaction parameter is passed for a write
|
|
operation for a transactional database, an auto-commit transaction is
|
|
automatically used.</p>
|
|
|
|
<p>With transactions, read and write locks are normally held until the end
|
|
of the transaction (commit or abort). Write locks are always held until the
|
|
end of the transaction. However, if <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a> is configured,
|
|
then read locks for cursor operations are only held during the operation and
|
|
while the cursor is positioned on the record. The read lock is released
|
|
when the cursor is moved to a different record or closed. When <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a> is used for a database (non-cursor) operation, the read
|
|
lock is released before the method returns.</p>
|
|
|
|
<p>When neither <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a> nor <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a> is
|
|
specified, read and write locking as described above provide Repeatable Read
|
|
isolation, which is the default transactional isolation level. If
|
|
Serializable isolation is configured, additional "next key" locking is
|
|
performed to prevent "phantoms" -- records that are not visible at one point
|
|
in a transaction but that become visible at a later point after being
|
|
inserted by another transaction. Serializable isolation is configured via
|
|
<a href="../../../com/sleepycat/je/TransactionConfig.html#setSerializableIsolation-boolean-"><code>TransactionConfig.setSerializableIsolation(boolean)</code></a> or <a href="../../../com/sleepycat/je/EnvironmentConfig.html#setTxnSerializableIsolation-boolean-"><code>EnvironmentConfig.setTxnSerializableIsolation(boolean)</code></a>.</p>
|
|
|
|
<p><strong>Non-Transactional Locking</strong></p>
|
|
|
|
<p>Non-transactional operations include all operations for a
|
|
non-transactional database (including a Deferred Write database), and read
|
|
operations for a transactional database when a null <a href="../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je"><code>Transaction</code></a>
|
|
parameter is passed.</p>
|
|
|
|
<p>For non-transactional operations, both read and write locks are only held
|
|
while a cursor is positioned on the record, and are released when the cursor
|
|
is moved to a different record or closed. For database (non-cursor)
|
|
operations, the read or write lock is released before the method
|
|
returns.</p>
|
|
|
|
<p>This behavior is similar to <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a>, except that both
|
|
read and write locks are released. Configuring <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a> for
|
|
a non-transactional database cursor has no effect.</p>
|
|
|
|
<p>Because the current thread is the accessor (locker) for non-transactional
|
|
operations, a single thread may have multiple cursors open without locking
|
|
conflicts. Two non-transactional cursors in the same thread may access the
|
|
same record via write or read operations without conflicts, and the changes
|
|
make by one cursor will be visible to the other cursor.</p>
|
|
|
|
<p>However, a non-transactional operation will conflict with a transactional
|
|
operation for the same record even when performed in the same thread. When
|
|
using a transaction in a particular thread for a particular database, to
|
|
avoid conflicts you should use that transaction for all access to that
|
|
database in that thread. In other words, to avoid conflicts always pass the
|
|
transaction parameter, not null, for all operations. If you don't wish to
|
|
hold the read lock for the duration of the transaction, specify <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a>.</p>
|
|
|
|
<p><strong>Read Uncommitted (Dirty-Read)</strong></string></p>
|
|
|
|
<p>When <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a> is configured, no locking is performed
|
|
by a read operation. <code>READ_UNCOMMITTED</code> does not apply to write
|
|
operations.</p>
|
|
|
|
<p><code>READ_UNCOMMITTED</code> is sometimes called dirty-read because records
|
|
are visible to the caller in their current state in the Btree at the time of
|
|
the read, even when that state is due to operations performed using a
|
|
transaction that has not yet committed. In addition, because no lock is
|
|
acquired by the dirty read operation, the record's state may change at any
|
|
time, even while a cursor used to do the dirty-read is still positioned on
|
|
the record.</p>
|
|
|
|
<p>To illustrate this, let's say a record is read with dirty-read
|
|
(<code>READ_UNCOMMITTED</code>) by calling <a href="../../../com/sleepycat/je/Cursor.html#getNext-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.LockMode-"><code>Cursor.getNext</code></a>
|
|
with a cursor C, and changes to the record are also being made in another
|
|
thread using transaction T. When a locking (non-dirty-read) call to <a href="../../../com/sleepycat/je/Cursor.html#getCurrent-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.LockMode-"><code>Cursor.getCurrent</code></a> is subsequently made to read the same
|
|
record again with C at the current position, a result may be returned that
|
|
is different than the result returned by the earlier call to <code>getNext</code>. For example:
|
|
<ul>
|
|
<li>If the record is updated by T after the dirty-read <code>getNext</code>
|
|
call, and T is committed, a subsequent call to <code>getCurrent</code> will
|
|
return the data updated by T.</li>
|
|
|
|
<li>If the record is updated by T before the dirty-read <code>getNext</code>
|
|
call, the <code>getNext</code> will returned the data updated by T. But if
|
|
call, the <code>getNext</code> will return the data updated by T. But if
|
|
T is then aborted, a subsequent call to <code>getCurrent</code> will return
|
|
the version of the data before it was updated by T.</li>
|
|
|
|
<li>If the record was inserted by T before the dirty-read <code>getNext</code> call, the <code>getNext</code> call will return the inserted record.
|
|
But if T is aborted, a subsequent call to <code>getCurrent</code> will return
|
|
<a href="../../../com/sleepycat/je/OperationStatus.html#KEYEMPTY"><code>OperationStatus.KEYEMPTY</code></a>.</li>
|
|
|
|
<li>If the record is deleted by T after the dirty-read <code>getNext</code>
|
|
call, and T is committed, a subsequent call to <code>getCurrent</code> will
|
|
return <a href="../../../com/sleepycat/je/OperationStatus.html#KEYEMPTY"><code>OperationStatus.KEYEMPTY</code></a>.</li>
|
|
</ul>
|
|
</p>
|
|
|
|
<p>Note that deleted records are handled specially in JE. Deleted records
|
|
remain in the Btree until after the deleting transaction is committed, and
|
|
they are removed from the Btree asynchronously (not immediately at commit
|
|
time). When using <code>#READ_UNCOMMITTED</code>, any record encountered in the
|
|
Btree that was previously deleted, whether or not the deleting transaction
|
|
has been committed, will be ignored (skipped over) by the read operation.
|
|
Of course, if the deleting transaction is aborted, the record will no longer
|
|
be deleted. If the application is scanning records, for example, this means
|
|
that such records may be skipped by the scan. If this behavior is not
|
|
desirable, <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED_ALL"><code>READ_UNCOMMITTED_ALL</code></a> may be used instead. This mode
|
|
ensures that records deleted by a transaction that is later aborted will not
|
|
be skipped by a read operation. This is accomplished in two different ways
|
|
depending on the type of database and whether the record's data is requested
|
|
by the operation.
|
|
<ol>
|
|
<li>If the DB is configured for duplicates or the record's data
|
|
is not requested, then a record that has been deleted by an open
|
|
transaction is returned by the read operation.</li>
|
|
|
|
<li>If the DB is not configured for duplicates and the record's data is
|
|
requested, then the read operation must wait for the deleting
|
|
transaction to close (commit or abort). After the transaction is
|
|
closed, the record will be returned if it is actually not deleted and
|
|
otherwise will be skipped.</li>
|
|
</ol>
|
|
|
|
<p>By "record data" we mean both the <code>data</code> parameter for a regular or
|
|
primary DB, and the <code>pKey</code> parameter for a secondary DB. By "record
|
|
data requested" we mean that all or part of the <code>DatabaseEntry</code> will
|
|
be returned by the read operation. Unless explicitly <em>not</em>
|
|
requested, the complete <code>DatabaseEntry</code> is returned. See
|
|
<a href="Cursor.html#partialEntry">Using Partial DatabaseEntry
|
|
Parameters</a> for more information.</p>
|
|
|
|
<p>Because of this difference in behavior, although <code>#READ_UNCOMMITTED</code> is fully non-blocking, <code>#READ_UNCOMMITTED_ALL</code> is
|
|
not (under the conditions described). As a result, when using <code>#READ_UNCOMMITTED_ALL</code> under these conditions, a <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> will be thrown when blocking results in a deadlock or
|
|
lock timeout.</p>
|
|
|
|
<p>To summarize, callers that use <code>READ_UNCOMMITTED</code> or <code>#READ_UNCOMMITTED_ALL</code> should be prepared for the following behaviors.
|
|
<ul>
|
|
<li>After a successful dirty-read operation, because no lock is acquired
|
|
the record can be changed by another transaction, even when the cursor
|
|
used to perform the dirty-read operation is still positioned on the
|
|
record.</li>
|
|
|
|
<li>After a successful dirty-read operation using a cursor C, say that
|
|
another transaction T deletes the record, and T is committed. In this
|
|
case, <a href="../../../com/sleepycat/je/OperationStatus.html#KEYEMPTY"><code>OperationStatus.KEYEMPTY</code></a> will be returned by the following
|
|
methods if they are called while C is still positioned on the deleted
|
|
record: <a href="../../../com/sleepycat/je/Cursor.html#getCurrent-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.DatabaseEntry-com.sleepycat.je.LockMode-"><code>Cursor.getCurrent</code></a>, <a href="../../../com/sleepycat/je/Cursor.html#putCurrent-com.sleepycat.je.DatabaseEntry-"><code>Cursor.putCurrent</code></a> and <a href="../../../com/sleepycat/je/Cursor.html#delete-com.sleepycat.je.WriteOptions-"><code>Cursor.delete</code></a>.</li>
|
|
|
|
<li>When using <code>READ_UNCOMMITTED</code>, deleted records will be skipped
|
|
even when the deleting transaction is still open. No blocking will occur
|
|
and <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> is never thrown when using this
|
|
mode.</li>
|
|
|
|
<li>When using <code>#READ_UNCOMMITTED_ALL</code>, deleted records will not
|
|
be skipped even when the deleting transaction is open. If the DB is a
|
|
duplicates DB or the record's data is not requested, the deleted record
|
|
will be returned. If the DB is not a duplicates DB and the record's
|
|
data is requested, blocking will occur until the deleting transaction is
|
|
closed. In the latter case, <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> will be thrown
|
|
when this blocking results in a deadlock or a lock timeout.</li>
|
|
</ul>
|
|
</p></div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="enum.constant.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Enum Constant Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Constant Summary table, listing enum constants, and an explanation">
|
|
<caption><span>Enum Constants</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Enum Constant and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#DEFAULT">DEFAULT</a></span></code>
|
|
<div class="block">Uses the default lock mode and is equivalent to passing <code>null</code> for
|
|
the lock mode parameter.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED">READ_COMMITTED</a></span></code>
|
|
<div class="block">Read committed isolation provides for cursor stability but not
|
|
repeatable reads.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED">READ_UNCOMMITTED</a></span></code>
|
|
<div class="block">Reads modified but not yet committed data.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED_ALL">READ_UNCOMMITTED_ALL</a></span></code>
|
|
<div class="block">Reads modified but not yet committed data, ensuring that records are not
|
|
skipped due to transaction aborts.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#RMW">RMW</a></span></code>
|
|
<div class="block">Acquire write locks instead of read locks when doing the retrieval.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/sleepycat/je/ReadOptions.html" title="class in com.sleepycat.je">ReadOptions</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#toReadOptions--">toReadOptions</a></span>()</code>
|
|
<div class="block">Returns a ReadOptions with this LockMode property, and default values
|
|
for all other properties.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#toString--">toString</a></span>()</code> </td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>static <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#valueOf-java.lang.String-">valueOf</a></span>(java.lang.String name)</code>
|
|
<div class="block">Returns the enum constant of this type with the specified name.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>static <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/je/LockMode.html#values--">values</a></span>()</code>
|
|
<div class="block">Returns an array containing the constants of this enum type, in
|
|
the order they are declared.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Enum">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.Enum</h3>
|
|
<code>clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf</code></li>
|
|
</ul>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.Object</h3>
|
|
<code>getClass, notify, notifyAll, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ============ ENUM CONSTANT DETAIL =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="enum.constant.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Enum Constant Detail</h3>
|
|
<a name="DEFAULT">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>DEFAULT</h4>
|
|
<pre>public static final <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> DEFAULT</pre>
|
|
<div class="block">Uses the default lock mode and is equivalent to passing <code>null</code> for
|
|
the lock mode parameter.
|
|
|
|
<p>The default lock mode is <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a> when this lock
|
|
mode is configured via <a href="../../../com/sleepycat/je/CursorConfig.html#setReadUncommitted-boolean-"><code>CursorConfig.setReadUncommitted(boolean)</code></a> or <a href="../../../com/sleepycat/je/TransactionConfig.html#setReadUncommitted-boolean-"><code>TransactionConfig.setReadUncommitted(boolean)</code></a>, or when using a <a href="../../../com/sleepycat/je/DiskOrderedCursor.html" title="class in com.sleepycat.je"><code>DiskOrderedCursor</code></a>. The Read Uncommitted mode overrides any other
|
|
configuration settings.</p>
|
|
|
|
<p>Otherwise, the default lock mode is <a href="../../../com/sleepycat/je/LockMode.html#READ_COMMITTED"><code>READ_COMMITTED</code></a> when this
|
|
lock mode is configured via <a href="../../../com/sleepycat/je/CursorConfig.html#setReadCommitted-boolean-"><code>CursorConfig.setReadCommitted(boolean)</code></a> or
|
|
<a href="../../../com/sleepycat/je/TransactionConfig.html#setReadCommitted-boolean-"><code>TransactionConfig.setReadCommitted(boolean)</code></a>. The Read Committed mode
|
|
overrides other configuration settings except for <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a>.</p>
|
|
|
|
<p>Otherwise, the default lock mode is to acquire read locks and release
|
|
them according to the <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je"><code>default locking rules</code></a> for
|
|
transactional and non-transactional operations.</p></div>
|
|
</li>
|
|
</ul>
|
|
<a name="READ_UNCOMMITTED">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>READ_UNCOMMITTED</h4>
|
|
<pre>public static final <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> READ_UNCOMMITTED</pre>
|
|
<div class="block">Reads modified but not yet committed data.
|
|
|
|
<p>The Read Uncommitted mode is used if this lock mode is explicitly
|
|
passed for the lock mode parameter, or if null or <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>DEFAULT</code></a> is
|
|
passed and Read Uncommitted is the default -- see <a href="../../../com/sleepycat/je/LockMode.html#DEFAULT"><code>DEFAULT</code></a> for
|
|
details.</p>
|
|
|
|
<p>Unlike <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED_ALL"><code>READ_UNCOMMITTED_ALL</code></a>, deleted records will be skipped
|
|
even when the deleting transaction is still open. No blocking will occur
|
|
and <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> is never thrown when using this
|
|
mode.</p>
|
|
|
|
<p>See the <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je"><code>locking rules</code></a> for information on how Read
|
|
Uncommitted impacts transactional and non-transactional locking.</p></div>
|
|
</li>
|
|
</ul>
|
|
<a name="READ_UNCOMMITTED_ALL">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>READ_UNCOMMITTED_ALL</h4>
|
|
<pre>public static final <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> READ_UNCOMMITTED_ALL</pre>
|
|
<div class="block">Reads modified but not yet committed data, ensuring that records are not
|
|
skipped due to transaction aborts.
|
|
|
|
<p>The Read Uncommitted mode is used only when this lock mode is
|
|
explicitly passed for the lock mode parameter.</p>
|
|
|
|
<p>Unlike <a href="../../../com/sleepycat/je/LockMode.html#READ_UNCOMMITTED"><code>READ_UNCOMMITTED</code></a>, deleted records will not be skipped
|
|
even when the deleting transaction is open. If the DB is a duplicates DB
|
|
or the record's data is not requested, the deleted record will be
|
|
returned. If the DB is not a duplicates DB and the record's data is
|
|
requested, blocking will occur until the deleting transaction is closed.
|
|
In the latter case, <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> will be thrown when
|
|
this blocking results in a deadlock or a lock timeout.</p>
|
|
|
|
<p>See the <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je"><code>locking rules</code></a> for information on how Read
|
|
Uncommitted impacts transactional and non-transactional locking.</p></div>
|
|
</li>
|
|
</ul>
|
|
<a name="READ_COMMITTED">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>READ_COMMITTED</h4>
|
|
<pre>public static final <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> READ_COMMITTED</pre>
|
|
<div class="block">Read committed isolation provides for cursor stability but not
|
|
repeatable reads. Data items which have been previously read by this
|
|
transaction may be deleted or modified by other transactions before the
|
|
cursor is closed or the transaction completes.
|
|
|
|
<p>Note that this LockMode may only be passed to <a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je"><code>Database</code></a> get
|
|
methods, not to <a href="../../../com/sleepycat/je/Cursor.html" title="class in com.sleepycat.je"><code>Cursor</code></a> methods. To configure a cursor for Read
|
|
Committed isolation, use <a href="../../../com/sleepycat/je/CursorConfig.html#setReadCommitted-boolean-"><code>CursorConfig.setReadCommitted(boolean)</code></a>.</p>
|
|
|
|
<p>See the <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je"><code>locking rules</code></a> for information on how Read
|
|
Committed impacts transactional and non-transactional locking.</p></div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="EnvironmentStats.html#cacheUnexpectedSizes">Cache
|
|
Statistics: Unexpected Sizes</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="RMW">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>RMW</h4>
|
|
<pre>public static final <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> RMW</pre>
|
|
<div class="block">Acquire write locks instead of read locks when doing the retrieval.
|
|
|
|
<p>Because it causes a write lock to be acquired, specifying this lock
|
|
mode as a <a href="../../../com/sleepycat/je/Cursor.html" title="class in com.sleepycat.je"><code>Cursor</code></a> or <a href="../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je"><code>Database</code></a> <code>get</code> (read) method
|
|
parameter will override the Read Committed or Read Uncommitted isolation
|
|
mode that is configured using <a href="../../../com/sleepycat/je/CursorConfig.html" title="class in com.sleepycat.je"><code>CursorConfig</code></a> or <a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je"><code>TransactionConfig</code></a>. The write lock will acquired and held until the end
|
|
of the transaction. For non-transactional use, the write lock will be
|
|
released when the cursor is moved to a new position or closed.</p>
|
|
|
|
<p>Setting this flag can eliminate deadlock during a read-modify-write
|
|
cycle by acquiring the write lock during the read part of the cycle so
|
|
that another thread of control acquiring a read lock for the same item,
|
|
in its own read-modify-write cycle, will not result in deadlock.</p></div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="values--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>values</h4>
|
|
<pre>public static <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>[] values()</pre>
|
|
<div class="block">Returns an array containing the constants of this enum type, in
|
|
the order they are declared. This method may be used to iterate
|
|
over the constants as follows:
|
|
<pre>
|
|
for (LockMode c : LockMode.values())
|
|
System.out.println(c);
|
|
</pre></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>an array containing the constants of this enum type, in the order they are declared</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="valueOf-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>valueOf</h4>
|
|
<pre>public static <a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a> valueOf(java.lang.String name)</pre>
|
|
<div class="block">Returns the enum constant of this type with the specified name.
|
|
The string must match <i>exactly</i> an identifier used to declare an
|
|
enum constant in this type. (Extraneous whitespace characters are
|
|
not permitted.)</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>name</code> - the name of the enum constant to be returned.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the enum constant with the specified name</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no constant with the specified name</dd>
|
|
<dd><code>java.lang.NullPointerException</code> - if the argument is null</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toReadOptions--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toReadOptions</h4>
|
|
<pre>public <a href="../../../com/sleepycat/je/ReadOptions.html" title="class in com.sleepycat.je">ReadOptions</a> toReadOptions()</pre>
|
|
<div class="block">Returns a ReadOptions with this LockMode property, and default values
|
|
for all other properties.
|
|
|
|
<p>WARNING: Do not modify the returned object, since it is a singleton.</div>
|
|
<dl>
|
|
<dt><span class="simpleTagLabel">Since:</span></dt>
|
|
<dd>7.0</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toString--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>toString</h4>
|
|
<pre>public java.lang.String toString()</pre>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
|
|
<dd><code>toString</code> in class <code>java.lang.Enum<<a href="../../../com/sleepycat/je/LockMode.html" title="enum in com.sleepycat.je">LockMode</a>></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/LockMode.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-all.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
|
|
</div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../../com/sleepycat/je/LockNotAvailableException.html" title="class in com.sleepycat.je"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/sleepycat/je/LockMode.html" target="_top">Frames</a></li>
|
|
<li><a href="LockMode.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#enum.constant.summary">Enum Constants</a> | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#enum.constant.detail">Enum Constants</a> | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
|
</body>
|
|
</html>
|