• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/docs/java/com/sleepycat/collections/
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.5.0) on Thu May 15 17:17:33 EDT 2008 -->
6<TITLE>
7TransactionRunner (Oracle - Berkeley DB Java API)
8</TITLE>
9
10<META NAME="keywords" CONTENT="com.sleepycat.collections.TransactionRunner class">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    parent.document.title="TransactionRunner (Oracle - Berkeley DB Java API)";
18}
19</SCRIPT>
20<NOSCRIPT>
21</NOSCRIPT>
22
23</HEAD>
24
25<BODY BGCOLOR="white" onload="windowTitle();">
26
27
28<!-- ========= START OF TOP NAVBAR ======= -->
29<A NAME="navbar_top"><!-- --></A>
30<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
31<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
32<TR>
33<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
34<A NAME="navbar_top_firstrow"><!-- --></A>
35<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
36  <TR ALIGN="center" VALIGN="top">
37  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
38  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
39  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/TransactionRunner.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
45  </TR>
46</TABLE>
47</TD>
48<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
49<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
50</TD>
51</TR>
52
53<TR>
54<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
55&nbsp;<A HREF="../../../com/sleepycat/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><B>PREV CLASS</B></A>&nbsp;
56&nbsp;<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58  <A HREF="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top"><B>FRAMES</B></A>  &nbsp;
59&nbsp;<A HREF="TransactionRunner.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
60&nbsp;<SCRIPT type="text/javascript">
61  <!--
62  if(window==top) {
63    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
64  }
65  //-->
66</SCRIPT>
67<NOSCRIPT>
68  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
69</NOSCRIPT>
70
71
72</FONT></TD>
73</TR>
74<TR>
75<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
76  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
78DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
79</TR>
80</TABLE>
81<A NAME="skip-navbar_top"></A>
82<!-- ========= END OF TOP NAVBAR ========= -->
83
84<HR>
85<!-- ======== START OF CLASS DATA ======== -->
86<H2>
87<FONT SIZE="-1">
88com.sleepycat.collections</FONT>
89<BR>
90Class TransactionRunner</H2>
91<PRE>
92<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>
93  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.collections.TransactionRunner</B>
94</PRE>
95<HR>
96<DL>
97<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>
98</PRE>
99
100<P>
101Starts a transaction, calls <A HREF="../../../com/sleepycat/collections/TransactionWorker.html#doWork()"><CODE>TransactionWorker.doWork()</CODE></A>, and handles
102 transaction retry and exceptions.  To perform a transaction, the user
103 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
104 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.
105
106 <p>A single TransactionRunner instance may be used by any number of threads
107 for any number of transactions.</p>
108
109 <p>The behavior of the run() method depends on whether the environment is
110 transactional, whether nested transactions are enabled, and whether a
111 transaction is already active.</p>
112
113 <ul>
114 <li>When the run() method is called in a transactional environment and no
115 transaction is active for the current thread, a new transaction is started
116 before calling doWork().  If DeadlockException is thrown by doWork(), the
117 transaction will be aborted and the process will be repeated up to the
118 maximum number of retries.  If another exception is thrown by doWork() or
119 the maximum number of retries has occurred, the transaction will be aborted
120 and the exception will be rethrown by the run() method.  If no exception is
121 thrown by doWork(), the transaction will be committed.  The run() method
122 will not attempt to commit or abort a transaction if it has already been
123 committed or aborted by doWork().</li>
124
125 <li>When the run() method is called and a transaction is active for the
126 current thread, and nested transactions are enabled, a nested transaction is
127 started before calling doWork().  The transaction that is active when
128 calling the run() method will become the parent of the nested transaction.
129 The nested transaction will be committed or aborted by the run() method
130 following the same rules described above.  Note that nested transactions may
131 not be enabled for the JE product, since JE does not support nested
132 transactions.</li>
133
134 <li>When the run() method is called in a non-transactional environment, the
135 doWork() method is called without starting a transaction.  The run() method
136 will return without committing or aborting a transaction, and any exceptions
137 thrown by the doWork() method will be thrown by the run() method.</li>
138
139 <li>When the run() method is called and a transaction is active for the
140 current thread and nested transactions are not enabled (the default) the
141 same rules as above apply. All the operations performed by the doWork()
142 method will be part of the currently active transaction.</li>
143 </ul>
144
145 <p>In a transactional environment, the rules described above support nested
146 calls to the run() method and guarantee that the outermost call will cause
147 the transaction to be committed or aborted.  This is true whether or not
148 nested transactions are supported or enabled.  Note that nested transactions
149 are provided as an optimization for improving concurrency but do not change
150 the meaning of the outermost transaction.  Nested transactions are not
151 currently supported by the JE product.</p>
152<P>
153
154<P>
155<HR>
156
157<P>
158<!-- =========== FIELD SUMMARY =========== -->
159
160<A NAME="field_summary"><!-- --></A>
161<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
162<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
163<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
164<B>Field Summary</B></FONT></TH>
165</TR>
166<TR BGCOLOR="white" CLASS="TableRowColor">
167<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
168<CODE>static&nbsp;int</CODE></FONT></TD>
169<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#DEFAULT_MAX_RETRIES">DEFAULT_MAX_RETRIES</A></B></CODE>
170
171<BR>
172&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The default maximum number of retries.</TD>
173</TR>
174</TABLE>
175&nbsp;
176<!-- ======== CONSTRUCTOR SUMMARY ======== -->
177
178<A NAME="constructor_summary"><!-- --></A>
179<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
180<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
181<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
182<B>Constructor Summary</B></FONT></TH>
183</TR>
184<TR BGCOLOR="white" CLASS="TableRowColor">
185<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>&nbsp;env)</CODE>
186
187<BR>
188&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a transaction runner for a given Berkeley DB environment.</TD>
189</TR>
190<TR BGCOLOR="white" CLASS="TableRowColor">
191<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>&nbsp;env,
192                  int&nbsp;maxRetries,
193                  <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A>&nbsp;config)</CODE>
194
195<BR>
196&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a transaction runner for a given Berkeley DB environment and
197 with a given number of maximum retries.</TD>
198</TR>
199</TABLE>
200&nbsp;
201<!-- ========== METHOD SUMMARY =========== -->
202
203<A NAME="method_summary"><!-- --></A>
204<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
205<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
206<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
207<B>Method Summary</B></FONT></TH>
208</TR>
209<TR BGCOLOR="white" CLASS="TableRowColor">
210<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
211<CODE>&nbsp;boolean</CODE></FONT></TD>
212<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getAllowNestedTransactions()">getAllowNestedTransactions</A></B>()</CODE>
213
214<BR>
215&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns whether nested transactions will be created if
216 <code>run()</code> is called when a transaction is already active for
217 the current thread.</TD>
218</TR>
219<TR BGCOLOR="white" CLASS="TableRowColor">
220<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
221<CODE>&nbsp;int</CODE></FONT></TD>
222<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getMaxRetries()">getMaxRetries</A></B>()</CODE>
223
224<BR>
225&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the maximum number of retries that will be performed when
226 deadlocks are detected.</TD>
227</TR>
228<TR BGCOLOR="white" CLASS="TableRowColor">
229<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
230<CODE>&nbsp;<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A></CODE></FONT></TD>
231<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#getTransactionConfig()">getTransactionConfig</A></B>()</CODE>
232
233<BR>
234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the transaction configuration used for calling
235 <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>
236</TR>
237<TR BGCOLOR="white" CLASS="TableRowColor">
238<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
239<CODE>&nbsp;void</CODE></FONT></TD>
240<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>&nbsp;worker)</CODE>
241
242<BR>
243&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calls the <A HREF="../../../com/sleepycat/collections/TransactionWorker.html#doWork()"><CODE>TransactionWorker.doWork()</CODE></A> method and, for transactional
244 environments, may begin and end a transaction.</TD>
245</TR>
246<TR BGCOLOR="white" CLASS="TableRowColor">
247<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
248<CODE>&nbsp;void</CODE></FONT></TD>
249<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#setAllowNestedTransactions(boolean)">setAllowNestedTransactions</A></B>(boolean&nbsp;allowNestedTxn)</CODE>
250
251<BR>
252&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Changes whether nested transactions will be created if
253 <code>run()</code> is called when a transaction is already active for
254 the current thread.</TD>
255</TR>
256<TR BGCOLOR="white" CLASS="TableRowColor">
257<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
258<CODE>&nbsp;void</CODE></FONT></TD>
259<TD><CODE><B><A HREF="../../../com/sleepycat/collections/TransactionRunner.html#setMaxRetries(int)">setMaxRetries</A></B>(int&nbsp;maxRetries)</CODE>
260
261<BR>
262&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Changes the maximum number of retries that will be performed when
263 deadlocks are detected.</TD>
264</TR>
265<TR BGCOLOR="white" CLASS="TableRowColor">
266<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
267<CODE>&nbsp;void</CODE></FONT></TD>
268<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>&nbsp;config)</CODE>
269
270<BR>
271&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Changes the transaction configuration used for calling
272 <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>
273</TR>
274</TABLE>
275&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
276<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
277<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
278<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>
279</TR>
280<TR BGCOLOR="white" CLASS="TableRowColor">
281<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>
282</TR>
283</TABLE>
284&nbsp;
285<P>
286
287<!-- ============ FIELD DETAIL =========== -->
288
289<A NAME="field_detail"><!-- --></A>
290<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
291<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
292<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
293<B>Field Detail</B></FONT></TH>
294</TR>
295</TABLE>
296
297<A NAME="DEFAULT_MAX_RETRIES"><!-- --></A><H3>
298DEFAULT_MAX_RETRIES</H3>
299<PRE>
300public static final int <B>DEFAULT_MAX_RETRIES</B></PRE>
301<DL>
302<DD>The default maximum number of retries.
303<P>
304<DL>
305<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.collections.TransactionRunner.DEFAULT_MAX_RETRIES">Constant Field Values</A></DL>
306</DL>
307
308<!-- ========= CONSTRUCTOR DETAIL ======== -->
309
310<A NAME="constructor_detail"><!-- --></A>
311<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
312<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
313<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
314<B>Constructor Detail</B></FONT></TH>
315</TR>
316</TABLE>
317
318<A NAME="TransactionRunner(com.sleepycat.db.Environment)"><!-- --></A><H3>
319TransactionRunner</H3>
320<PRE>
321public <B>TransactionRunner</B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A>&nbsp;env)</PRE>
322<DL>
323<DD>Creates a transaction runner for a given Berkeley DB environment.
324 The default maximum number of retries (<A HREF="../../../com/sleepycat/collections/TransactionRunner.html#DEFAULT_MAX_RETRIES"><CODE>DEFAULT_MAX_RETRIES</CODE></A>) and
325 a null (default) <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db"><CODE>TransactionConfig</CODE></A> will be used.
326<P>
327<DL>
328<DT><B>Parameters:</B><DD><CODE>env</CODE> - is the environment for running transactions.</DL>
329</DL>
330<HR>
331
332<A NAME="TransactionRunner(com.sleepycat.db.Environment, int, com.sleepycat.db.TransactionConfig)"><!-- --></A><H3>
333TransactionRunner</H3>
334<PRE>
335public <B>TransactionRunner</B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A>&nbsp;env,
336                         int&nbsp;maxRetries,
337                         <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A>&nbsp;config)</PRE>
338<DL>
339<DD>Creates a transaction runner for a given Berkeley DB environment and
340 with a given number of maximum retries.
341<P>
342<DL>
343<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
344 performed when deadlocks are detected.<DD><CODE>config</CODE> - the transaction configuration used for calling
345 <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
346 configuration.  The configuration object is not cloned, and
347 any modifications to it will impact subsequent transactions.</DL>
348</DL>
349
350<!-- ============ METHOD DETAIL ========== -->
351
352<A NAME="method_detail"><!-- --></A>
353<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
354<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
355<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
356<B>Method Detail</B></FONT></TH>
357</TR>
358</TABLE>
359
360<A NAME="getMaxRetries()"><!-- --></A><H3>
361getMaxRetries</H3>
362<PRE>
363public int <B>getMaxRetries</B>()</PRE>
364<DL>
365<DD>Returns the maximum number of retries that will be performed when
366 deadlocks are detected.
367<P>
368<DD><DL>
369</DL>
370</DD>
371</DL>
372<HR>
373
374<A NAME="setMaxRetries(int)"><!-- --></A><H3>
375setMaxRetries</H3>
376<PRE>
377public void <B>setMaxRetries</B>(int&nbsp;maxRetries)</PRE>
378<DL>
379<DD>Changes the maximum number of retries that will be performed when
380 deadlocks are detected.
381 Calling this method does not impact transactions already running.
382<P>
383<DD><DL>
384</DL>
385</DD>
386</DL>
387<HR>
388
389<A NAME="getAllowNestedTransactions()"><!-- --></A><H3>
390getAllowNestedTransactions</H3>
391<PRE>
392public boolean <B>getAllowNestedTransactions</B>()</PRE>
393<DL>
394<DD>Returns whether nested transactions will be created if
395 <code>run()</code> is called when a transaction is already active for
396 the current thread.
397 By default this property is false.
398
399 <p>Note that this method always returns false in the JE product, since
400 nested transactions are not supported by JE.</p>
401<P>
402<DD><DL>
403</DL>
404</DD>
405</DL>
406<HR>
407
408<A NAME="setAllowNestedTransactions(boolean)"><!-- --></A><H3>
409setAllowNestedTransactions</H3>
410<PRE>
411public void <B>setAllowNestedTransactions</B>(boolean&nbsp;allowNestedTxn)</PRE>
412<DL>
413<DD>Changes whether nested transactions will be created if
414 <code>run()</code> is called when a transaction is already active for
415 the current thread.
416 Calling this method does not impact transactions already running.
417
418 <p>Note that true may not be passed to this method in the JE product,
419 since nested transactions are not supported by JE.</p>
420<P>
421<DD><DL>
422</DL>
423</DD>
424</DL>
425<HR>
426
427<A NAME="getTransactionConfig()"><!-- --></A><H3>
428getTransactionConfig</H3>
429<PRE>
430public <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> <B>getTransactionConfig</B>()</PRE>
431<DL>
432<DD>Returns the transaction configuration used for calling
433 <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>.
434
435 <p>If this property is null, the default configuration is used.  The
436 configuration object is not cloned, and any modifications to it will
437 impact subsequent transactions.</p>
438<P>
439<DD><DL>
440
441<DT><B>Returns:</B><DD>the transaction configuration.</DL>
442</DD>
443</DL>
444<HR>
445
446<A NAME="setTransactionConfig(com.sleepycat.db.TransactionConfig)"><!-- --></A><H3>
447setTransactionConfig</H3>
448<PRE>
449public void <B>setTransactionConfig</B>(<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A>&nbsp;config)</PRE>
450<DL>
451<DD>Changes the transaction configuration used for calling
452 <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>.
453
454 <p>If this property is null, the default configuration is used.  The
455 configuration object is not cloned, and any modifications to it will
456 impact subsequent transactions.</p>
457<P>
458<DD><DL>
459<DT><B>Parameters:</B><DD><CODE>config</CODE> - the transaction configuration.</DL>
460</DD>
461</DL>
462<HR>
463
464<A NAME="run(com.sleepycat.collections.TransactionWorker)"><!-- --></A><H3>
465run</H3>
466<PRE>
467public void <B>run</B>(<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections">TransactionWorker</A>&nbsp;worker)
468         throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A>,
469                <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>
470<DL>
471<DD>Calls the <A HREF="../../../com/sleepycat/collections/TransactionWorker.html#doWork()"><CODE>TransactionWorker.doWork()</CODE></A> method and, for transactional
472 environments, may begin and end a transaction.  If the environment given
473 is non-transactional, a transaction will not be used but the doWork()
474 method will still be called.  See the class description for more
475 information.
476<P>
477<DD><DL>
478
479<DT><B>Throws:</B>
480<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
481 maximum number of retries has occurred.  The transaction will have been
482 aborted by this method.
483<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
484 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
485 this method.
486<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL>
487</DD>
488</DL>
489<!-- ========= END OF CLASS DATA ========= -->
490<HR>
491
492
493<!-- ======= START OF BOTTOM NAVBAR ====== -->
494<A NAME="navbar_bottom"><!-- --></A>
495<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
496<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
497<TR>
498<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
499<A NAME="navbar_bottom_firstrow"><!-- --></A>
500<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
501  <TR ALIGN="center" VALIGN="top">
502  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
503  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
504  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
505  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/TransactionRunner.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
506  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
507  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
508  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
509  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
510  </TR>
511</TABLE>
512</TD>
513<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
514<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM>
515</TD>
516</TR>
517
518<TR>
519<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
520&nbsp;<A HREF="../../../com/sleepycat/collections/StoredValueSet.html" title="class in com.sleepycat.collections"><B>PREV CLASS</B></A>&nbsp;
521&nbsp;<A HREF="../../../com/sleepycat/collections/TransactionWorker.html" title="interface in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD>
522<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
523  <A HREF="../../../index.html?com/sleepycat/collections/TransactionRunner.html" target="_top"><B>FRAMES</B></A>  &nbsp;
524&nbsp;<A HREF="TransactionRunner.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
525&nbsp;<SCRIPT type="text/javascript">
526  <!--
527  if(window==top) {
528    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
529  }
530  //-->
531</SCRIPT>
532<NOSCRIPT>
533  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
534</NOSCRIPT>
535
536
537</FONT></TD>
538</TR>
539<TR>
540<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
541  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
542<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
543DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
544</TR>
545</TABLE>
546<A NAME="skip-navbar_bottom"></A>
547<!-- ======== END OF BOTTOM NAVBAR ======= -->
548
549<HR>
550<font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
551</BODY>
552</HTML>
553