553 lines
28 KiB
HTML
553 lines
28 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 -->
|
|
<TITLE>
|
|
TransactionRunner (Oracle - Berkeley DB Java API)
|
|
</TITLE>
|
|
|
|
<META NAME="keywords" CONTENT="com.sleepycat.collections.TransactionRunner class">
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
parent.document.title="TransactionRunner (Oracle - Berkeley DB Java API)";
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TransactionRunner.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../com/sleepycat/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="TransactionRunner.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<H2>
|
|
<FONT SIZE="-1">
|
|
com.sleepycat.collections</FONT>
|
|
<BR>
|
|
Class TransactionRunner</H2>
|
|
<PRE>
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
|
|
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.collections.TransactionRunner</B>
|
|
</PRE>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public class <B>TransactionRunner</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL>
|
|
</PRE>
|
|
|
|
<P>
|
|
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(com.sleepycat.collections.TransactionWorker)</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>
|
|
<P>
|
|
|
|
<P>
|
|
<HR>
|
|
|
|
<P>
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
|
|
<A NAME="field_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Field Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE>static int</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#DEFAULT_MAX_RETRIES">DEFAULT_MAX_RETRIES</A></B></CODE>
|
|
|
|
<BR>
|
|
The default maximum number of retries.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
|
<A NAME="constructor_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Constructor Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#TransactionRunner(com.sleepycat.db.Environment)">TransactionRunner</A></B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> env)</CODE>
|
|
|
|
<BR>
|
|
Creates a transaction runner for a given Berkeley DB environment.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#TransactionRunner(com.sleepycat.db.Environment, int, com.sleepycat.db.TransactionConfig)">TransactionRunner</A></B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> env,
|
|
int maxRetries,
|
|
<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config)</CODE>
|
|
|
|
<BR>
|
|
Creates a transaction runner for a given Berkeley DB environment and
|
|
with a given number of maximum retries.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
<A NAME="method_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Method Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> boolean</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getAllowNestedTransactions()">getAllowNestedTransactions</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> int</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getMaxRetries()">getMaxRetries</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns the maximum number of retries that will be performed when
|
|
deadlocks are detected.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getTransactionConfig()">getTransactionConfig</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Returns the transaction configuration used for calling
|
|
<A HREF="../../../com/sleepycat/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>.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#run(com.sleepycat.collections.TransactionWorker)">run</A></B>(<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</A> worker)</CODE>
|
|
|
|
<BR>
|
|
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.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#setAllowNestedTransactions(boolean)">setAllowNestedTransactions</A></B>(boolean allowNestedTxn)</CODE>
|
|
|
|
<BR>
|
|
Changes whether nested transactions will be created if
|
|
<code>run()</code> is called when a transaction is already active for
|
|
the current thread.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#setMaxRetries(int)">setMaxRetries</A></B>(int maxRetries)</CODE>
|
|
|
|
<BR>
|
|
Changes the maximum number of retries that will be performed when
|
|
deadlocks are detected.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> void</CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#setTransactionConfig(com.sleepycat.db.TransactionConfig)">setTransactionConfig</A></B>(<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config)</CODE>
|
|
|
|
<BR>
|
|
Changes the transaction configuration used for calling
|
|
<A HREF="../../../com/sleepycat/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>.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
<!-- ============ FIELD DETAIL =========== -->
|
|
|
|
<A NAME="field_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Field Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="DEFAULT_MAX_RETRIES"><!-- --></A><H3>
|
|
DEFAULT_MAX_RETRIES</H3>
|
|
<PRE>
|
|
public static final int <B>DEFAULT_MAX_RETRIES</B></PRE>
|
|
<DL>
|
|
<DD>The default maximum number of retries.
|
|
<P>
|
|
<DL>
|
|
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.collections.TransactionRunner.DEFAULT_MAX_RETRIES">Constant Field Values</A></DL>
|
|
</DL>
|
|
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
|
|
<A NAME="constructor_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Constructor Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="TransactionRunner(com.sleepycat.db.Environment)"><!-- --></A><H3>
|
|
TransactionRunner</H3>
|
|
<PRE>
|
|
public <B>TransactionRunner</B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> env)</PRE>
|
|
<DL>
|
|
<DD>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/db/TransactionConfig.html" title="class in com.sleepycat.db"><CODE>TransactionConfig</CODE></A> will be used.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>env</CODE> - is the environment for running transactions.</DL>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="TransactionRunner(com.sleepycat.db.Environment, int, com.sleepycat.db.TransactionConfig)"><!-- --></A><H3>
|
|
TransactionRunner</H3>
|
|
<PRE>
|
|
public <B>TransactionRunner</B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> env,
|
|
int maxRetries,
|
|
<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config)</PRE>
|
|
<DL>
|
|
<DD>Creates a transaction runner for a given Berkeley DB environment and
|
|
with a given number of maximum retries.
|
|
<P>
|
|
<DL>
|
|
<DT><B>Parameters:</B><DD><CODE>env</CODE> - is the environment for running transactions.<DD><CODE>maxRetries</CODE> - is the maximum number of retries that will be
|
|
performed when deadlocks are detected.<DD><CODE>config</CODE> - the transaction configuration used for calling
|
|
<A HREF="../../../com/sleepycat/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.</DL>
|
|
</DL>
|
|
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
|
|
<A NAME="method_detail"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
|
<B>Method Detail</B></FONT></TH>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<A NAME="getMaxRetries()"><!-- --></A><H3>
|
|
getMaxRetries</H3>
|
|
<PRE>
|
|
public int <B>getMaxRetries</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns the maximum number of retries that will be performed when
|
|
deadlocks are detected.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setMaxRetries(int)"><!-- --></A><H3>
|
|
setMaxRetries</H3>
|
|
<PRE>
|
|
public void <B>setMaxRetries</B>(int maxRetries)</PRE>
|
|
<DL>
|
|
<DD>Changes the maximum number of retries that will be performed when
|
|
deadlocks are detected.
|
|
Calling this method does not impact transactions already running.
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getAllowNestedTransactions()"><!-- --></A><H3>
|
|
getAllowNestedTransactions</H3>
|
|
<PRE>
|
|
public boolean <B>getAllowNestedTransactions</B>()</PRE>
|
|
<DL>
|
|
<DD>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.
|
|
|
|
<p>Note that this method always returns false in the JE product, since
|
|
nested transactions are not supported by JE.</p>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setAllowNestedTransactions(boolean)"><!-- --></A><H3>
|
|
setAllowNestedTransactions</H3>
|
|
<PRE>
|
|
public void <B>setAllowNestedTransactions</B>(boolean allowNestedTxn)</PRE>
|
|
<DL>
|
|
<DD>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.
|
|
|
|
<p>Note that true may not be passed to this method in the JE product,
|
|
since nested transactions are not supported by JE.</p>
|
|
<P>
|
|
<DD><DL>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="getTransactionConfig()"><!-- --></A><H3>
|
|
getTransactionConfig</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> <B>getTransactionConfig</B>()</PRE>
|
|
<DL>
|
|
<DD>Returns the transaction configuration used for calling
|
|
<A HREF="../../../com/sleepycat/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>
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>the transaction configuration.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setTransactionConfig(com.sleepycat.db.TransactionConfig)"><!-- --></A><H3>
|
|
setTransactionConfig</H3>
|
|
<PRE>
|
|
public void <B>setTransactionConfig</B>(<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config)</PRE>
|
|
<DL>
|
|
<DD>Changes the transaction configuration used for calling
|
|
<A HREF="../../../com/sleepycat/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>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>config</CODE> - the transaction configuration.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="run(com.sleepycat.collections.TransactionWorker)"><!-- --></A><H3>
|
|
run</H3>
|
|
<PRE>
|
|
public void <B>run</B>(<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</A> worker)
|
|
throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>,
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></PRE>
|
|
<DL>
|
|
<DD>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.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Throws:</B>
|
|
<DD><CODE><A HREF="../../../com/sleepycat/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><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Exception.html" title="class or interface in java.lang">Exception</A></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><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL>
|
|
</DD>
|
|
</DL>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<TR ALIGN="center" VALIGN="top">
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TransactionRunner.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../com/sleepycat/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="TransactionRunner.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
<font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font>
|
|
</BODY>
|
|
</HTML>
|