mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
860 lines
38 KiB
HTML
860 lines
38 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 (11.0.7) on Mon Jun 01 06:40:53 PDT 2020 -->
|
|
<title>Transaction (Oracle - Berkeley DB Java API)</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="date" content="2020-06-01">
|
|
<link rel="stylesheet" type="text/css" href="../../../style.css" title="Style">
|
|
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
|
|
<script type="text/javascript" src="../../../script.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
|
|
<!--[if IE]>
|
|
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
|
|
<![endif]-->
|
|
<script type="text/javascript" src="../../../jquery/jquery-3.4.1.js"></script>
|
|
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="Transaction (Oracle - Berkeley DB Java API)";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
var pathtoroot = "../../../";
|
|
var useModuleDirectories = true;
|
|
loadScripts(document, 'script');</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<div class="fixedNav">
|
|
<!-- ========= 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="../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Transaction.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</b><br><font size="-1"> version 18.1.40</font></div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses.html">All Classes</a></li>
|
|
</ul>
|
|
<ul class="navListSearch">
|
|
<li><label for="search">SEARCH:</label>
|
|
<input type="text" id="search" value="search" disabled="disabled">
|
|
<input type="reset" id="reset" value="reset" disabled="disabled">
|
|
</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>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
</div>
|
|
<div class="navPadding"> </div>
|
|
<script type="text/javascript"><!--
|
|
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
|
|
//-->
|
|
</script>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">com.sleepycat.db</a></div>
|
|
<h2 title="Class Transaction" class="title">Class Transaction</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.sleepycat.db.Transaction</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<pre>public class <span class="typeNameLabel">Transaction</span>
|
|
extends java.lang.Object</pre>
|
|
<div class="block">The Transaction object is the handle for a transaction. Methods off the
|
|
transaction handle are used to configure, abort and commit the
|
|
transaction. Transaction handles are provided to other Berkeley DB
|
|
methods in order to transactionally protect those operations.
|
|
<p>
|
|
Transaction handles are not free-threaded; transactions handles may
|
|
be used by multiple threads, but only serially, that is, the application
|
|
must serialize access to the handle. Once the
|
|
<a href="#abort--"><code>Transaction.abort</code></a>, <a href="#commit--"><code>Transaction.commit</code></a> or
|
|
<a href="#discard--"><code>Transaction.discard</code></a>
|
|
methods are called, the handle may
|
|
not be accessed again (except to retrieve the commit token),
|
|
regardless of the success or failure of the method.
|
|
In addition, parent transactions may not issue any Berkeley DB operations
|
|
while they have active child transactions (child transactions that have
|
|
not yet been committed or aborted) except for <a href="Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction</code></a>, <a href="#abort--"><code>Transaction.abort</code></a> and <a href="#commit--"><code>Transaction.commit</code></a>.
|
|
<p>
|
|
To obtain a transaction with default attributes:
|
|
<blockquote><pre>
|
|
Transaction txn = myEnvironment.beginTransaction(null, null);
|
|
</pre></blockquote>
|
|
To customize the attributes of a transaction:
|
|
<blockquote><pre>
|
|
TransactionConfig config = new TransactionConfig();
|
|
config.setDirtyRead(true);
|
|
Transaction txn = myEnvironment.beginTransaction(null, config);
|
|
</pre></blockquote></div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary" 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="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="colSecond" scope="col">Method</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#abort--">abort</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Cause an abnormal termination of the transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#commit--">commit</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">End the transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#commitNoSync--">commitNoSync</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">End the transaction, not committing synchronously.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#commitSync--">commitSync</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">End the transaction, committing synchronously.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#commitWriteNoSync--">commitWriteNoSync</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">End the transaction, writing but not flushing the log.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#discard--">discard</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Free up all the per-process resources associated with the specified
|
|
<a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle, neither committing nor aborting the
|
|
transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>byte[]</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getCommitToken--">getCommitToken</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Fetch the transaction's commit token.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getId--">getId</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Return the transaction's unique ID.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getName--">getName</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Get the user visible name for the transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getPriority--">getPriority</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Get the transaction's deadlock priority.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#prepare-byte:A-">prepare</a></span>​(byte[] gid)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Initiate the beginning of a two-phase commit.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setLockTimeout-long-">setLockTimeout</a></span>​(long timeOut)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Configure the lock request timeout value for the transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i12" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setName-java.lang.String-">setName</a></span>​(java.lang.String name)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Set the user visible name for the transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setPriority-int-">setPriority</a></span>​(int priority)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Set the deadlock priority for this transaction.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setTxnTimeout-long-">setTxnTimeout</a></span>​(long timeOut)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Configure the timeout value for the transaction lifetime.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<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>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="getCommitToken--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getCommitToken</h4>
|
|
<pre class="methodSignature">public byte[] getCommitToken()
|
|
throws java.lang.IllegalStateException</pre>
|
|
<div class="block">Fetch the transaction's commit token.
|
|
<p>
|
|
This operation can only be performed after this transaction has committed.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The commit token generated at the commit time of this transaction.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code>java.lang.IllegalStateException</code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="abort--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>abort</h4>
|
|
<pre class="methodSignature">public void abort()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Cause an abnormal termination of the transaction.
|
|
<p>
|
|
The log is played backward, and any necessary undo operations are done.
|
|
Before Transaction.abort returns, any locks held by the transaction will
|
|
have been released.
|
|
<p>
|
|
In the case of nested transactions, aborting a parent transaction
|
|
causes all children (unresolved or not) of the parent transaction
|
|
to be aborted.
|
|
<p>
|
|
All cursors opened within the transaction must be closed before the
|
|
transaction is aborted.
|
|
This method closes all open <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles.
|
|
And if a close operation fails, the rest of
|
|
the cursors are closed, and the database environment is set to the panic state.
|
|
<p>
|
|
After Transaction.abort has been called, regardless of its return, the
|
|
<a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be accessed again.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="commit--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>commit</h4>
|
|
<pre class="methodSignature">public void commit()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">End the transaction. If the environment is configured for synchronous
|
|
commit, the transaction will be committed synchronously to stable
|
|
storage before the call returns. This means the transaction will exhibit
|
|
all of the ACID (atomicity, consistency, isolation, and durability)
|
|
properties.
|
|
<p>
|
|
If the environment is not configured for synchronous commit, the commit
|
|
will not necessarily have been committed to stable storage before the
|
|
call returns. This means the transaction will exhibit the ACI (atomicity,
|
|
consistency, and isolation) properties, but not D (durability); that is,
|
|
database integrity will be maintained, but it is possible this transaction
|
|
may be undone during recovery.
|
|
<p>
|
|
In the case of nested transactions, if the transaction is a parent
|
|
transaction, committing the parent transaction causes all unresolved
|
|
children of the parent to be committed. In the case of nested
|
|
transactions, if the transaction is a child transaction, its locks are
|
|
not released, but are acquired by its parent. Although the commit of the
|
|
child transaction will succeed, the actual resolution of the child
|
|
transaction is postponed until the parent transaction is committed or
|
|
aborted; that is, if its parent transaction commits, it will be
|
|
committed; and if its parent transaction aborts, it will be aborted.
|
|
<p>
|
|
All cursors opened within the transaction must be closed before the
|
|
transaction is committed.
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the transaction
|
|
is aborted and the first such error is returned.
|
|
<p>
|
|
After this method returns, the <a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be
|
|
accessed again (except to retrieve the commit token),
|
|
regardless of the method's success or failure. If the
|
|
method encounters an error, the transaction and all child transactions
|
|
of the transaction will have been aborted when the call returns.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="commitSync--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>commitSync</h4>
|
|
<pre class="methodSignature">public void commitSync()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">End the transaction, committing synchronously. This means the
|
|
transaction will exhibit all of the ACID (atomicity, consistency,
|
|
isolation, and durability) properties.
|
|
<p>
|
|
This behavior is the default for database environments unless otherwise
|
|
configured using the <a href="EnvironmentConfig.html#setTxnNoSync-boolean-"><code>EnvironmentConfig.setTxnNoSync</code></a> method. This
|
|
behavior may also be set for a single transaction using the
|
|
<a href="Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction</code></a> method. Any value specified to
|
|
this method overrides both of those settings.
|
|
<p>
|
|
In the case of nested transactions, if the transaction is a parent
|
|
transaction, committing the parent transaction causes all unresolved
|
|
children of the parent to be committed. In the case of nested
|
|
transactions, if the transaction is a child transaction, its locks are
|
|
not released, but are acquired by its parent. Although the commit of the
|
|
child transaction will succeed, the actual resolution of the child
|
|
transaction is postponed until the parent transaction is committed or
|
|
aborted; that is, if its parent transaction commits, it will be
|
|
committed; and if its parent transaction aborts, it will be aborted.
|
|
<p>
|
|
All cursors opened within the transaction must be closed before the
|
|
transaction is committed.
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the transaction
|
|
is aborted and the first such error is returned.
|
|
<p>
|
|
After this method returns, the <a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be
|
|
accessed again (except to retrieve the commit token),
|
|
regardless of the method's success or failure. If the
|
|
method encounters an error, the transaction and all child transactions
|
|
of the transaction will have been aborted when the call returns.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="commitNoSync--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>commitNoSync</h4>
|
|
<pre class="methodSignature">public void commitNoSync()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">End the transaction, not committing synchronously.
|
|
This means the
|
|
transaction will exhibit the ACI (atomicity, consistency, and isolation)
|
|
properties, but not D (durability); that is, database integrity will be
|
|
maintained, but it is possible this transaction may be undone during
|
|
recovery.
|
|
<p>
|
|
This behavior may be set for a database environment using the
|
|
<a href="EnvironmentConfig.html#setTxnNoSync-boolean-"><code>EnvironmentConfig.setTxnNoSync</code></a> method or for a single transaction
|
|
using the <a href="Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction</code></a> method. Any value
|
|
specified to this method overrides both of those settings.
|
|
<p>
|
|
In the case of nested transactions, if the transaction is a parent
|
|
transaction, committing the parent transaction causes all unresolved
|
|
children of the parent to be committed. In the case of nested
|
|
transactions, if the transaction is a child transaction, its locks are
|
|
not released, but are acquired by its parent. Although the commit of the
|
|
child transaction will succeed, the actual resolution of the child
|
|
transaction is postponed until the parent transaction is committed or
|
|
aborted; that is, if its parent transaction commits, it will be
|
|
committed; and if its parent transaction aborts, it will be aborted.
|
|
<p>
|
|
All cursors opened within the transaction must be closed before the
|
|
transaction is committed.
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the transaction
|
|
is aborted and the first such error is returned.
|
|
<p>
|
|
After this method returns, the <a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be
|
|
accessed again (except to retrieve the commit token),
|
|
regardless of the method's success or failure. If the
|
|
method encounters an error, the transaction and all child transactions
|
|
of the transaction will have been aborted when the call returns.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="commitWriteNoSync--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>commitWriteNoSync</h4>
|
|
<pre class="methodSignature">public void commitWriteNoSync()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">End the transaction, writing but not flushing the log.
|
|
This means the
|
|
transaction will exhibit the ACI (atomicity, consistency, and isolation)
|
|
properties, but not D (durability); that is, database integrity will be
|
|
maintained, but it is possible this transaction may be undone during
|
|
recovery in the event that the operating system crashes. This option
|
|
provides more durability than an asynchronous commit and has less
|
|
performance cost than a synchronous commit.
|
|
<p>
|
|
This behavior may be set for a database environment using the
|
|
<a href="EnvironmentConfig.html#setTxnWriteNoSync-boolean-"><code>EnvironmentConfig.setTxnWriteNoSync</code></a> method or for a single
|
|
transaction using the <a href="Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction</code></a> method.
|
|
Any value specified to this method overrides both of those settings.
|
|
<p>
|
|
In the case of nested transactions, if the transaction is a parent
|
|
transaction, committing the parent transaction causes all unresolved
|
|
children of the parent to be committed. In the case of nested
|
|
transactions, if the transaction is a child transaction, its locks are
|
|
not released, but are acquired by its parent. Although the commit of the
|
|
child transaction will succeed, the actual resolution of the child
|
|
transaction is postponed until the parent transaction is committed or
|
|
aborted; that is, if its parent transaction commits, it will be
|
|
committed; and if its parent transaction aborts, it will be aborted.
|
|
<p>
|
|
All cursors opened within the transaction must be closed before the
|
|
transaction is committed.
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the transaction
|
|
is aborted and the first such error is returned.
|
|
<p>
|
|
After this method returns, the <a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be
|
|
accessed again (except to retrieve the commit token),
|
|
regardless of the method's success or failure. If the
|
|
method encounters an error, the transaction and all child transactions
|
|
of the transaction will have been aborted when the call returns.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="discard--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>discard</h4>
|
|
<pre class="methodSignature">public void discard()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Free up all the per-process resources associated with the specified
|
|
<a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle, neither committing nor aborting the
|
|
transaction. This call may be used only after calls to
|
|
<a href="Environment.html#recover-int-boolean-"><code>Environment.recover</code></a> when there are multiple global
|
|
transaction managers recovering transactions in a single database
|
|
environment. Any transactions returned by <a href="Environment.html#recover-int-boolean-"><code>Environment.recover</code></a> that are not handled by the current global transaction
|
|
manager should be discarded using this method.
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the first such error is returned.
|
|
<p>
|
|
The <a href="Transaction.html" title="class in com.sleepycat.db"><code>Transaction</code></a> handle may not be accessed again after this
|
|
method has been called, regardless of the method's success or failure.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getId--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getId</h4>
|
|
<pre class="methodSignature">public int getId()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Return the transaction's unique ID.
|
|
<p>
|
|
Locking calls made on behalf of this transaction should use the
|
|
value returned from this method as the locker parameter to the
|
|
<a href="Environment.html#getLock-int-boolean-com.sleepycat.db.DatabaseEntry-com.sleepycat.db.LockRequestMode-"><code>Environment.getLock</code></a> or <a href="Environment.html#lockVector-int-boolean-com.sleepycat.db.LockRequest:A-"><code>Environment.lockVector</code></a>
|
|
calls.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The transaction's unique ID.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getName--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getName</h4>
|
|
<pre class="methodSignature">public java.lang.String getName()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Get the user visible name for the transaction.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The user visible name for the transaction.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getPriority--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getPriority</h4>
|
|
<pre class="methodSignature">public int getPriority()
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Get the transaction's deadlock priority.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The deadlock priority for the transaction.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="prepare-byte:A-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>prepare</h4>
|
|
<pre class="methodSignature">public void prepare​(byte[] gid)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Initiate the beginning of a two-phase commit.
|
|
<p>
|
|
In a distributed transaction environment, Berkeley DB can be used
|
|
as a local transaction manager. In this case, the distributed
|
|
transaction manager must send <em>prepare</em> messages to each
|
|
local manager. The local manager must then issue a
|
|
<a href="#prepare-byte:A-"><code>Transaction.prepare</code></a> call and await its successful return
|
|
before responding to the distributed transaction manager. Only
|
|
after the distributed transaction manager receives successful
|
|
responses from all of its <em>prepare</em> messages should it issue
|
|
any <em>commit</em> messages.
|
|
<p>
|
|
In the case of nested transactions, preparing the parent causes all
|
|
unresolved children of the parent transaction to be committed.
|
|
Child transactions should never be explicitly prepared. Their fate
|
|
will be resolved along with their parent's during global recovery.
|
|
<p>
|
|
If there are <a href="Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles
|
|
open when this method is called, they are all closed inside this method. And
|
|
if there are errors when closing the cursor handles, the first such error is returned.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>gid</code> - The global transaction ID by which this transaction will be known.
|
|
This global transaction ID will be returned in calls to
|
|
<a href="Environment.html#recover-int-boolean-"><code>Environment.recover</code></a> method, telling the application which
|
|
global transactions must be resolved. The gid parameter must be sized
|
|
at least DB_XIDDATASIZE (currently 128) bytes; only the first
|
|
DB_XIDDATASIZE bytes are used.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setName-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setName</h4>
|
|
<pre class="methodSignature">public void setName​(java.lang.String name)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Set the user visible name for the transaction.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>name</code> - The user visible name for the transaction.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setPriority-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setPriority</h4>
|
|
<pre class="methodSignature">public void setPriority​(int priority)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Set the deadlock priority for this transaction. The deadlock detector will
|
|
reject lock requests from lower priority transactions before those from
|
|
higher priority transactions.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>priority</code> - The deadlock priority for the transaction.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setTxnTimeout-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setTxnTimeout</h4>
|
|
<pre class="methodSignature">public void setTxnTimeout​(long timeOut)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Configure the timeout value for the transaction lifetime.
|
|
<p>
|
|
If the transaction runs longer than this time, the transaction may
|
|
may throw <a href="DatabaseException.html" title="class in com.sleepycat.db"><code>DatabaseException</code></a>.
|
|
<p>
|
|
Timeouts are checked whenever a thread of control blocks on a lock
|
|
or when deadlock detection is performed. For this reason, the
|
|
accuracy of the timeout depends on how often deadlock detection is
|
|
performed.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>timeOut</code> - The timeout value for the transaction lifetime, in microseconds. As
|
|
the value is an unsigned 32-bit number of microseconds, the maximum
|
|
timeout is roughly 71 minutes. A value of 0 disables timeouts for
|
|
the transaction.
|
|
<p>
|
|
This method may be called at any time during the life of the application.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setLockTimeout-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>setLockTimeout</h4>
|
|
<pre class="methodSignature">public void setLockTimeout​(long timeOut)
|
|
throws <a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre>
|
|
<div class="block">Configure the lock request timeout value for the transaction.
|
|
<p>
|
|
If a lock request cannot be granted in this time, the transaction
|
|
may throw <a href="DatabaseException.html" title="class in com.sleepycat.db"><code>DatabaseException</code></a>.
|
|
<p>
|
|
Timeouts are checked whenever a thread of control blocks on a lock
|
|
or when deadlock detection is performed. For this reason, the
|
|
accuracy of the timeout depends on how often deadlock detection is
|
|
performed.
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>timeOut</code> - The lock request timeout value for the transaction, in microseconds.
|
|
As the value is an unsigned 32-bit number of microseconds, the maximum
|
|
timeout is roughly 71 minutes. A value of 0 disables timeouts for the
|
|
transaction.
|
|
<p>
|
|
This method may be called at any time during the life of the application.
|
|
<p></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</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="../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Transaction.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</b><br><font size="-1"> version 18.1.40</font></div>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses.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>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li>Constr | </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) 1996, 2020 Oracle and/or its affiliates. All rights reserved.</font></small></p>
|
|
</body>
|
|
</html>
|