mirror of
https://github.com/berkeleydb/je.git
synced 2024-11-15 09:46:25 +00:00
650 lines
31 KiB
HTML
650 lines
31 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>TransactionRunner (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="TransactionRunner (Oracle - Berkeley DB Java Edition API)";
|
||
|
}
|
||
|
}
|
||
|
catch(err) {
|
||
|
}
|
||
|
//-->
|
||
|
var methods = {"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";
|
||
|
</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/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 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/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><span class="typeNameLink">Prev Class</span></a></li>
|
||
|
<li><a href="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><span class="typeNameLink">Next Class</span></a></li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top">Frames</a></li>
|
||
|
<li><a href="TransactionRunner.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="#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 ========= -->
|
||
|
<!-- ======== START OF CLASS DATA ======== -->
|
||
|
<div class="header">
|
||
|
<div class="subTitle">com.sleepycat.collections</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>
|
||
|
<br>
|
||
|
<pre>public class <span class="typeNameLabel">TransactionRunner</span>
|
||
|
extends java.lang.Object</pre>
|
||
|
<div class="block">Starts a transaction, calls <a href="../../../com/sleepycat/collections/TransactionWorker.html#doWork--"><code>TransactionWorker.doWork()</code></a>, and handles
|
||
|
transaction retry and exceptions. To perform a transaction, the user
|
||
|
implements the <a href="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><code>TransactionWorker</code></a> interface and passes an instance of
|
||
|
that class to the <a href="../../../com/sleepycat/collections/TransactionRunner.html#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 LockConflictException 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>
|
||
|
<dl>
|
||
|
<dt><span class="simpleTagLabel">Author:</span></dt>
|
||
|
<dd>Mark Hayes</dd>
|
||
|
</dl>
|
||
|
</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" border="0" cellpadding="3" cellspacing="0" 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="colLast" scope="col">Field and Description</th>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colFirst"><code>static int</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#DEFAULT_MAX_RETRIES">DEFAULT_MAX_RETRIES</a></span></code>
|
||
|
<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" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
||
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
||
|
<tr>
|
||
|
<th class="colOne" scope="col">Constructor and Description</th>
|
||
|
</tr>
|
||
|
<tr class="altColor">
|
||
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#TransactionRunner-com.sleepycat.je.Environment-">TransactionRunner</a></span>(<a href="../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env)</code>
|
||
|
<div class="block">Creates a transaction runner for a given Berkeley DB environment.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr class="rowColor">
|
||
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#TransactionRunner-com.sleepycat.je.Environment-int-com.sleepycat.je.TransactionConfig-">TransactionRunner</a></span>(<a href="../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env,
|
||
|
int maxRetries,
|
||
|
<a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">TransactionConfig</a> config)</code>
|
||
|
<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" 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="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>boolean</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#getAllowNestedTransactions--">getAllowNestedTransactions</a></span>()</code>
|
||
|
<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>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#getMaxRetries--">getMaxRetries</a></span>()</code>
|
||
|
<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="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">TransactionConfig</a></code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#getTransactionConfig--">getTransactionConfig</a></span>()</code>
|
||
|
<div class="block">Returns the transaction configuration used for calling
|
||
|
<a href="../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)</code></a>.</div>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr id="i3" class="rowColor">
|
||
|
<td class="colFirst"><code>int</code></td>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#handleException-java.lang.Exception-int-int-">handleException</a></span>(java.lang.Exception exception,
|
||
|
int retries,
|
||
|
int maxRetries)</code>
|
||
|
<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>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#run-com.sleepycat.collections.TransactionWorker-">run</a></span>(<a href="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</a> worker)</code>
|
||
|
<div class="block">Calls the <a href="../../../com/sleepycat/collections/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>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#setAllowNestedTransactions-boolean-">setAllowNestedTransactions</a></span>(boolean allowNestedTxn)</code>
|
||
|
<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>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#setMaxRetries-int-">setMaxRetries</a></span>(int maxRetries)</code>
|
||
|
<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>
|
||
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/sleepycat/collections/TransactionRunner.html#setTransactionConfig-com.sleepycat.je.TransactionConfig-">setTransactionConfig</a></span>(<a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">TransactionConfig</a> config)</code>
|
||
|
<div class="block">Changes the transaction configuration used for calling
|
||
|
<a href="../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.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.je.Environment-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>TransactionRunner</h4>
|
||
|
<pre>public TransactionRunner(<a href="../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">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="../../../com/sleepycat/collections/TransactionRunner.html#DEFAULT_MAX_RETRIES"><code>DEFAULT_MAX_RETRIES</code></a>) and
|
||
|
a null (default) <a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je"><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.je.Environment-int-com.sleepycat.je.TransactionConfig-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockListLast">
|
||
|
<li class="blockList">
|
||
|
<h4>TransactionRunner</h4>
|
||
|
<pre>public TransactionRunner(<a href="../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a> env,
|
||
|
int maxRetries,
|
||
|
<a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">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="../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.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>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>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>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>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>public <a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">TransactionConfig</a> getTransactionConfig()</pre>
|
||
|
<div class="block">Returns the transaction configuration used for calling
|
||
|
<a href="../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.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.je.TransactionConfig-">
|
||
|
<!-- -->
|
||
|
</a>
|
||
|
<ul class="blockList">
|
||
|
<li class="blockList">
|
||
|
<h4>setTransactionConfig</h4>
|
||
|
<pre>public void setTransactionConfig(<a href="../../../com/sleepycat/je/TransactionConfig.html" title="class in com.sleepycat.je">TransactionConfig</a> config)</pre>
|
||
|
<div class="block">Changes the transaction configuration used for calling
|
||
|
<a href="../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-"><code>Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.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>public void run(<a href="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</a> worker)
|
||
|
throws <a href="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a>,
|
||
|
java.lang.Exception</pre>
|
||
|
<div class="block">Calls the <a href="../../../com/sleepycat/collections/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="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je">LockConflictException</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="../../../com/sleepycat/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="../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">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>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="../../../com/sleepycat/collections/TransactionRunner.html#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="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</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="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</code></a> occurs, to override the default behavior
|
||
|
which is to throw the <a href="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</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="../../../com/sleepycat/collections/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="../../../com/sleepycat/collections/TransactionRunner.html#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="../../../com/sleepycat/collections/TransactionRunner.html#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="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</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="../../../com/sleepycat/collections/TransactionRunner.html#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="../../../com/sleepycat/je/LockConflictException.html" title="class in com.sleepycat.je"><code>LockConflictException</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="../../../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/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 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/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><span class="typeNameLink">Prev Class</span></a></li>
|
||
|
<li><a href="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><span class="typeNameLink">Next Class</span></a></li>
|
||
|
</ul>
|
||
|
<ul class="navList">
|
||
|
<li><a href="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top">Frames</a></li>
|
||
|
<li><a href="TransactionRunner.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="#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) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
|
||
|
</body>
|
||
|
</html>
|