mirror of
https://github.com/yasuhirokimura/db18
synced 2026-06-08 18:29:23 +00:00
672 lines
30 KiB
HTML
672 lines
30 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>TransactionRunner (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="TransactionRunner (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};
|
|
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/TransactionRunner.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><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </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.collections</a></div>
|
|
<h2 title="Class TransactionRunner" class="title">Class TransactionRunner</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.sleepycat.collections.TransactionRunner</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<pre>public class <span class="typeNameLabel">TransactionRunner</span>
|
|
extends java.lang.Object</pre>
|
|
<div class="block">Starts a transaction, calls <a href="TransactionWorker.html#doWork--"><code>TransactionWorker.doWork()</code></a>, and handles
|
|
transaction retry and exceptions. To perform a transaction, the user
|
|
implements the <a href="TransactionWorker.html" title="interface in com.sleepycat.collections"><code>TransactionWorker</code></a> interface and passes an instance of
|
|
that class to the <a href="#run-com.sleepycat.collections.TransactionWorker-"><code>run</code></a> method.
|
|
|
|
<p>A single TransactionRunner instance may be used by any number of threads
|
|
for any number of transactions.</p>
|
|
|
|
<p>The behavior of the run() method depends on whether the environment is
|
|
transactional, whether nested transactions are enabled, and whether a
|
|
transaction is already active.</p>
|
|
|
|
<ul>
|
|
<li>When the run() method is called in a transactional environment and no
|
|
transaction is active for the current thread, a new transaction is started
|
|
before calling doWork(). If DeadlockException is thrown by doWork(),
|
|
the transaction will be aborted and the process will be repeated up to the
|
|
maximum number of retries. If another exception is thrown by doWork() or
|
|
the maximum number of retries has occurred, the transaction will be aborted
|
|
and the exception will be rethrown by the run() method. If no exception is
|
|
thrown by doWork(), the transaction will be committed. The run() method
|
|
will not attempt to commit or abort a transaction if it has already been
|
|
committed or aborted by doWork().</li>
|
|
|
|
<li>When the run() method is called and a transaction is active for the
|
|
current thread, and nested transactions are enabled, a nested transaction is
|
|
started before calling doWork(). The transaction that is active when
|
|
calling the run() method will become the parent of the nested transaction.
|
|
The nested transaction will be committed or aborted by the run() method
|
|
following the same rules described above. Note that nested transactions may
|
|
not be enabled for the JE product, since JE does not support nested
|
|
transactions.</li>
|
|
|
|
<li>When the run() method is called in a non-transactional environment, the
|
|
doWork() method is called without starting a transaction. The run() method
|
|
will return without committing or aborting a transaction, and any exceptions
|
|
thrown by the doWork() method will be thrown by the run() method.</li>
|
|
|
|
<li>When the run() method is called and a transaction is active for the
|
|
current thread and nested transactions are not enabled (the default) the
|
|
same rules as above apply. All the operations performed by the doWork()
|
|
method will be part of the currently active transaction.</li>
|
|
</ul>
|
|
|
|
<p>In a transactional environment, the rules described above support nested
|
|
calls to the run() method and guarantee that the outermost call will cause
|
|
the transaction to be committed or aborted. This is true whether or not
|
|
nested transactions are supported or enabled. Note that nested transactions
|
|
are provided as an optimization for improving concurrency but do not change
|
|
the meaning of the outermost transaction. Nested transactions are not
|
|
currently supported by the JE product.</p></div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Summary</h3>
|
|
<table class="memberSummary" summary="Field Summary table, listing fields, and an explanation">
|
|
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colSecond" scope="col">Field</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#DEFAULT_MAX_RETRIES">DEFAULT_MAX_RETRIES</a></span></code></th>
|
|
<td class="colLast">
|
|
<div class="block">The default maximum number of retries.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="memberSummary" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Constructor</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#TransactionRunner-com.sleepycat.db.Environment-">TransactionRunner</a></span>​(<a href="../db/Environment.html" title="class in com.sleepycat.db">Environment</a> env)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a transaction runner for a given Berkeley DB environment.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#TransactionRunner-com.sleepycat.db.Environment-int-com.sleepycat.db.TransactionConfig-">TransactionRunner</a></span>​(<a href="../db/Environment.html" title="class in com.sleepycat.db">Environment</a> env,
|
|
int maxRetries,
|
|
<a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a> config)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a transaction runner for a given Berkeley DB environment and
|
|
with a given number of maximum retries.</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" 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>boolean</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getAllowNestedTransactions--">getAllowNestedTransactions</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Returns whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getMaxRetries--">getMaxRetries</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Returns the maximum number of retries that will be performed when
|
|
deadlocks are detected.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code><a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a></code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getTransactionConfig--">getTransactionConfig</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Returns the transaction configuration used for calling
|
|
<a href="../db/Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</code></a>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#handleException-java.lang.Exception-int-int-">handleException</a></span>​(java.lang.Exception exception,
|
|
int retries,
|
|
int maxRetries)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Handles exceptions that occur during a transaction, and may implement
|
|
transaction retry policy.</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="#run-com.sleepycat.collections.TransactionWorker-">run</a></span>​(<a href="TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</a> worker)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Calls the <a href="TransactionWorker.html#doWork--"><code>TransactionWorker.doWork()</code></a> method and, for transactional
|
|
environments, may begin and end a transaction.</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="#setAllowNestedTransactions-boolean-">setAllowNestedTransactions</a></span>​(boolean allowNestedTxn)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Changes whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setMaxRetries-int-">setMaxRetries</a></span>​(int maxRetries)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Changes the maximum number of retries that will be performed when
|
|
deadlocks are detected.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setTransactionConfig-com.sleepycat.db.TransactionConfig-">setTransactionConfig</a></span>​(<a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a> config)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Changes the transaction configuration used for calling
|
|
<a href="../db/Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</code></a>.</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">
|
|
<!-- ============ FIELD DETAIL =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Detail</h3>
|
|
<a name="DEFAULT_MAX_RETRIES">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>DEFAULT_MAX_RETRIES</h4>
|
|
<pre>public static final int DEFAULT_MAX_RETRIES</pre>
|
|
<div class="block">The default maximum number of retries.</div>
|
|
<dl>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="../../../constant-values.html#com.sleepycat.collections.TransactionRunner.DEFAULT_MAX_RETRIES">Constant Field Values</a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="TransactionRunner-com.sleepycat.db.Environment-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>TransactionRunner</h4>
|
|
<pre>public TransactionRunner​(<a href="../db/Environment.html" title="class in com.sleepycat.db">Environment</a> env)</pre>
|
|
<div class="block">Creates a transaction runner for a given Berkeley DB environment.
|
|
The default maximum number of retries (<a href="#DEFAULT_MAX_RETRIES"><code>DEFAULT_MAX_RETRIES</code></a>) and
|
|
a null (default) <a href="../db/TransactionConfig.html" title="class in com.sleepycat.db"><code>TransactionConfig</code></a> will be used.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>env</code> - is the environment for running transactions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="TransactionRunner-com.sleepycat.db.Environment-int-com.sleepycat.db.TransactionConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>TransactionRunner</h4>
|
|
<pre>public TransactionRunner​(<a href="../db/Environment.html" title="class in com.sleepycat.db">Environment</a> env,
|
|
int maxRetries,
|
|
<a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a> config)</pre>
|
|
<div class="block">Creates a transaction runner for a given Berkeley DB environment and
|
|
with a given number of maximum retries.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>env</code> - is the environment for running transactions.</dd>
|
|
<dd><code>maxRetries</code> - is the maximum number of retries that will be
|
|
performed when deadlocks are detected.</dd>
|
|
<dd><code>config</code> - the transaction configuration used for calling
|
|
<a href="../db/Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</code></a>, or null to use the default
|
|
configuration. The configuration object is not cloned, and
|
|
any modifications to it will impact subsequent transactions.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="getMaxRetries--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getMaxRetries</h4>
|
|
<pre class="methodSignature">public int getMaxRetries()</pre>
|
|
<div class="block">Returns the maximum number of retries that will be performed when
|
|
deadlocks are detected.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the maximum number of retries.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setMaxRetries-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setMaxRetries</h4>
|
|
<pre class="methodSignature">public void setMaxRetries​(int maxRetries)</pre>
|
|
<div class="block">Changes the maximum number of retries that will be performed when
|
|
deadlocks are detected.
|
|
Calling this method does not impact transactions already running.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>maxRetries</code> - the maximum number of retries.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getAllowNestedTransactions--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getAllowNestedTransactions</h4>
|
|
<pre class="methodSignature">public boolean getAllowNestedTransactions()</pre>
|
|
<div class="block">Returns whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.
|
|
By default this property is false.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>whether nested transactions will be created.
|
|
|
|
<p>Note that this method always returns false in the JE product, since
|
|
nested transactions are not supported by JE.</p></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setAllowNestedTransactions-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setAllowNestedTransactions</h4>
|
|
<pre class="methodSignature">public void setAllowNestedTransactions​(boolean allowNestedTxn)</pre>
|
|
<div class="block">Changes whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.
|
|
Calling this method does not impact transactions already running.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>allowNestedTxn</code> - whether nested transactions will be created.
|
|
|
|
<p>Note that true may not be passed to this method in the JE product,
|
|
since nested transactions are not supported by JE.</p></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getTransactionConfig--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getTransactionConfig</h4>
|
|
<pre class="methodSignature">public <a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a> getTransactionConfig()</pre>
|
|
<div class="block">Returns the transaction configuration used for calling
|
|
<a href="../db/Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</code></a>.
|
|
|
|
<p>If this property is null, the default configuration is used. The
|
|
configuration object is not cloned, and any modifications to it will
|
|
impact subsequent transactions.</p></div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the transaction configuration.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="setTransactionConfig-com.sleepycat.db.TransactionConfig-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>setTransactionConfig</h4>
|
|
<pre class="methodSignature">public void setTransactionConfig​(<a href="../db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</a> config)</pre>
|
|
<div class="block">Changes the transaction configuration used for calling
|
|
<a href="../db/Environment.html#beginTransaction-com.sleepycat.db.Transaction-com.sleepycat.db.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</code></a>.
|
|
|
|
<p>If this property is null, the default configuration is used. The
|
|
configuration object is not cloned, and any modifications to it will
|
|
impact subsequent transactions.</p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>config</code> - the transaction configuration.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="run-com.sleepycat.collections.TransactionWorker-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>run</h4>
|
|
<pre class="methodSignature">public void run​(<a href="TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</a> worker)
|
|
throws <a href="../db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a>,
|
|
java.lang.Exception</pre>
|
|
<div class="block">Calls the <a href="TransactionWorker.html#doWork--"><code>TransactionWorker.doWork()</code></a> method and, for transactional
|
|
environments, may begin and end a transaction. If the environment given
|
|
is non-transactional, a transaction will not be used but the doWork()
|
|
method will still be called. See the class description for more
|
|
information.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>worker</code> - the TransactionWorker.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../db/DeadlockException.html" title="class in com.sleepycat.db">DeadlockException</a></code> - when it is thrown by doWork() and the
|
|
maximum number of retries has occurred. The transaction will have been
|
|
aborted by this method.</dd>
|
|
<dd><code>java.lang.Exception</code> - when any other exception is thrown by doWork(). The
|
|
exception will first be unwrapped by calling <a href="../util/ExceptionUnwrapper.html#unwrap-java.lang.Exception-"><code>ExceptionUnwrapper.unwrap(java.lang.Exception)</code></a>. The transaction will have been aborted by
|
|
this method.</dd>
|
|
<dd><code><a href="../db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="handleException-java.lang.Exception-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>handleException</h4>
|
|
<pre class="methodSignature">public int handleException​(java.lang.Exception exception,
|
|
int retries,
|
|
int maxRetries)
|
|
throws java.lang.Exception</pre>
|
|
<div class="block">Handles exceptions that occur during a transaction, and may implement
|
|
transaction retry policy. The transaction is aborted by the <a href="#run-com.sleepycat.collections.TransactionWorker-"><code>run</code></a> method before calling this method.
|
|
|
|
<p>The default implementation of this method throws the <code>
|
|
exception</code> parameter if it is not an instance of <a href="../db/DeadlockException.html" title="class in com.sleepycat.db"><code>DeadlockException</code></a> and otherwise returns the <code>maxRetries</code>
|
|
parameter value. This method can be overridden to throw a different
|
|
exception or return a different number of retries. For example:</p>
|
|
<ul>
|
|
<li>This method could call <code>Thread.sleep</code> for a short interval to
|
|
allow other transactions to finish.</li>
|
|
|
|
<li>This method could return a different <code>maxRetries</code> value
|
|
depending on the <code>exception</code> that occurred.</li>
|
|
|
|
<li>This method could throw an application-defined exception when the
|
|
<code>retries</code> value is greater or equal to the <code>maxRetries</code> and
|
|
a <a href="../db/DeadlockException.html" title="class in com.sleepycat.db"><code>DeadlockException</code></a> occurs, to override the default behavior
|
|
which is to throw the <a href="../db/DeadlockException.html" title="class in com.sleepycat.db"><code>DeadlockException</code></a>.</li>
|
|
</ul></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>exception</code> - an exception that was thrown by the <a href="TransactionWorker.html#doWork--"><code>TransactionWorker.doWork()</code></a> method or thrown when beginning or committing
|
|
the transaction. If the <code>retries</code> value is greater or equal to
|
|
<code>maxRetries</code> when this method returns normally, this exception
|
|
will be thrown by the <a href="#run-com.sleepycat.collections.TransactionWorker-"><code>run</code></a> method.</dd>
|
|
<dd><code>retries</code> - the current value of a counter that starts out at zero
|
|
and is incremented when each retry is performed.</dd>
|
|
<dd><code>maxRetries</code> - the maximum retries to be performed. By default,
|
|
this value is set to <a href="#getMaxRetries--"><code>getMaxRetries()</code></a>. This method may return a
|
|
different maximum retries value to override that default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the maximum number of retries to perform. The
|
|
default policy is to return the <code>maxRetries</code> parameter value
|
|
if the <code>exception</code> parameter value is an instance of <a href="../db/DeadlockException.html" title="class in com.sleepycat.db"><code>DeadlockException</code></a>.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code>java.lang.Exception</code> - to cause the exception to be thrown by the <a href="#run-com.sleepycat.collections.TransactionWorker-"><code>run</code></a> method. The default policy is to throw the <code>exception</code>
|
|
parameter value if it is not an instance of <a href="../db/DeadlockException.html" title="class in com.sleepycat.db"><code>DeadlockException</code></a>.</dd>
|
|
<dt><span class="simpleTagLabel">Since:</span></dt>
|
|
<dd>3.4</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/TransactionRunner.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><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </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>
|