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:32 EDT 2008 --> 6<TITLE> 7Transaction (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="keywords" CONTENT="com.sleepycat.db.Transaction 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="Transaction (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> </TD> 38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 39 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Transaction.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </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 <A HREF="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> 56 <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../index.html?com/sleepycat/db/Transaction.html" target="_top"><B>FRAMES</B></A> 59 <A HREF="Transaction.html" target="_top"><B>NO FRAMES</B></A> 60 <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 78DETAIL: FIELD | CONSTR | <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.db</FONT> 89<BR> 90Class Transaction</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.db.Transaction</B> 94</PRE> 95<HR> 96<DL> 97<DT><PRE>public class <B>Transaction</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> 101The Transaction object is the handle for a transaction. Methods off the 102transaction handle are used to configure, abort and commit the 103transaction. Transaction handles are provided to other Berkeley DB 104methods in order to transactionally protect those operations. 105<p> 106Transaction handles are not free-threaded; transactions handles may 107be used by multiple threads, but only serially, that is, the application 108must serialize access to the handle. Once the 109<A HREF="../../../com/sleepycat/db/Transaction.html#abort()"><CODE>Transaction.abort</CODE></A>, <A HREF="../../../com/sleepycat/db/Transaction.html#commit()"><CODE>Transaction.commit</CODE></A> or 110<A HREF="../../../com/sleepycat/db/Transaction.html#discard()"><CODE>Transaction.discard</CODE></A> 111methods are called, the handle may 112not be accessed again, regardless of the success or failure of the method. 113In addition, parent transactions may not issue any Berkeley DB operations 114while they have active child transactions (child transactions that have 115not yet been committed or aborted) except for <A HREF="../../../com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction</CODE></A>, <A HREF="../../../com/sleepycat/db/Transaction.html#abort()"><CODE>Transaction.abort</CODE></A> and <A HREF="../../../com/sleepycat/db/Transaction.html#commit()"><CODE>Transaction.commit</CODE></A>. 116<p> 117To obtain a transaction with default attributes: 118<blockquote><pre> 119 Transaction txn = myEnvironment.beginTransaction(null, null); 120</pre></blockquote> 121To customize the attributes of a transaction: 122<blockquote><pre> 123 TransactionConfig config = new TransactionConfig(); 124 config.setDirtyRead(true); 125 Transaction txn = myEnvironment.beginTransaction(null, config); 126</pre></blockquote> 127<P> 128 129<P> 130<HR> 131 132<P> 133 134<!-- ========== METHOD SUMMARY =========== --> 135 136<A NAME="method_summary"><!-- --></A> 137<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 138<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 139<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 140<B>Method Summary</B></FONT></TH> 141</TR> 142<TR BGCOLOR="white" CLASS="TableRowColor"> 143<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 144<CODE> void</CODE></FONT></TD> 145<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#abort()">abort</A></B>()</CODE> 146 147<BR> 148 Cause an abnormal termination of the transaction.</TD> 149</TR> 150<TR BGCOLOR="white" CLASS="TableRowColor"> 151<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 152<CODE> void</CODE></FONT></TD> 153<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#commit()">commit</A></B>()</CODE> 154 155<BR> 156 End the transaction.</TD> 157</TR> 158<TR BGCOLOR="white" CLASS="TableRowColor"> 159<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 160<CODE> void</CODE></FONT></TD> 161<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#commitNoSync()">commitNoSync</A></B>()</CODE> 162 163<BR> 164 End the transaction, not committing synchronously.</TD> 165</TR> 166<TR BGCOLOR="white" CLASS="TableRowColor"> 167<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 168<CODE> void</CODE></FONT></TD> 169<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#commitSync()">commitSync</A></B>()</CODE> 170 171<BR> 172 End the transaction, committing synchronously.</TD> 173</TR> 174<TR BGCOLOR="white" CLASS="TableRowColor"> 175<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 176<CODE> void</CODE></FONT></TD> 177<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#commitWriteNoSync()">commitWriteNoSync</A></B>()</CODE> 178 179<BR> 180 End the transaction, writing but not flushing the log.</TD> 181</TR> 182<TR BGCOLOR="white" CLASS="TableRowColor"> 183<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 184<CODE> void</CODE></FONT></TD> 185<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#discard()">discard</A></B>()</CODE> 186 187<BR> 188 Free up all the per-process resources associated with the specified 189 <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle, neither committing nor aborting the 190 transaction.</TD> 191</TR> 192<TR BGCOLOR="white" CLASS="TableRowColor"> 193<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 194<CODE> int</CODE></FONT></TD> 195<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#getId()">getId</A></B>()</CODE> 196 197<BR> 198 Return the transaction's unique ID.</TD> 199</TR> 200<TR BGCOLOR="white" CLASS="TableRowColor"> 201<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 202<CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD> 203<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#getName()">getName</A></B>()</CODE> 204 205<BR> 206 Get the user visible name for the transaction.</TD> 207</TR> 208<TR BGCOLOR="white" CLASS="TableRowColor"> 209<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 210<CODE> void</CODE></FONT></TD> 211<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#prepare(byte[])">prepare</A></B>(byte[] gid)</CODE> 212 213<BR> 214 Initiate the beginning of a two-phase commit.</TD> 215</TR> 216<TR BGCOLOR="white" CLASS="TableRowColor"> 217<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 218<CODE> void</CODE></FONT></TD> 219<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#setLockTimeout(long)">setLockTimeout</A></B>(long timeOut)</CODE> 220 221<BR> 222 Configure the lock request timeout value for the transaction.</TD> 223</TR> 224<TR BGCOLOR="white" CLASS="TableRowColor"> 225<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 226<CODE> void</CODE></FONT></TD> 227<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#setName(java.lang.String)">setName</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</CODE> 228 229<BR> 230 Set the user visible name for the transaction.</TD> 231</TR> 232<TR BGCOLOR="white" CLASS="TableRowColor"> 233<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 234<CODE> void</CODE></FONT></TD> 235<TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#setTxnTimeout(long)">setTxnTimeout</A></B>(long timeOut)</CODE> 236 237<BR> 238 Configure the timeout value for the transaction lifetime.</TD> 239</TR> 240</TABLE> 241 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 242<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 243<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 244<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> 245</TR> 246<TR BGCOLOR="white" CLASS="TableRowColor"> 247<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> 248</TR> 249</TABLE> 250 251<P> 252 253<!-- ============ METHOD DETAIL ========== --> 254 255<A NAME="method_detail"><!-- --></A> 256<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 257<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 258<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 259<B>Method Detail</B></FONT></TH> 260</TR> 261</TABLE> 262 263<A NAME="abort()"><!-- --></A><H3> 264abort</H3> 265<PRE> 266public void <B>abort</B>() 267 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 268<DL> 269<DD>Cause an abnormal termination of the transaction. 270 <p> 271 The log is played backward, and any necessary undo operations are done. 272 Before Transaction.abort returns, any locks held by the transaction will 273 have been released. 274 <p> 275 In the case of nested transactions, aborting a parent transaction 276 causes all children (unresolved or not) of the parent transaction 277 to be aborted. 278 <p> 279 All cursors opened within the transaction must be closed before the 280 transaction is aborted. 281 <p> 282 After Transaction.abort has been called, regardless of its return, the 283 <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be accessed again. 284 <p> 285 <p> 286<P> 287<DD><DL> 288 289<DT><B>Throws:</B> 290<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 291</DD> 292</DL> 293<HR> 294 295<A NAME="commit()"><!-- --></A><H3> 296commit</H3> 297<PRE> 298public void <B>commit</B>() 299 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 300<DL> 301<DD>End the transaction. If the environment is configured for synchronous 302commit, the transaction will be committed synchronously to stable 303storage before the call returns. This means the transaction will exhibit 304all of the ACID (atomicity, consistency, isolation, and durability) 305properties. 306<p> 307If the environment is not configured for synchronous commit, the commit 308will not necessarily have been committed to stable storage before the 309call returns. This means the transaction will exhibit the ACI (atomicity, 310consistency, and isolation) properties, but not D (durability); that is, 311database integrity will be maintained, but it is possible this transaction 312may be undone during recovery. 313<p> 314In the case of nested transactions, if the transaction is a parent 315transaction, committing the parent transaction causes all unresolved 316children of the parent to be committed. In the case of nested 317transactions, if the transaction is a child transaction, its locks are 318not released, but are acquired by its parent. Although the commit of the 319child transaction will succeed, the actual resolution of the child 320transaction is postponed until the parent transaction is committed or 321aborted; that is, if its parent transaction commits, it will be 322committed; and if its parent transaction aborts, it will be aborted. 323<p> 324All cursors opened within the transaction must be closed before the 325transaction is committed. 326<p> 327After this method returns the <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be 328accessed again, regardless of the method's success or failure. If the 329method encounters an error, the transaction and all child transactions 330of the transaction will have been aborted when the call returns. 331<p> 332<p> 333<P> 334<DD><DL> 335 336<DT><B>Throws:</B> 337<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 338</DD> 339</DL> 340<HR> 341 342<A NAME="commitSync()"><!-- --></A><H3> 343commitSync</H3> 344<PRE> 345public void <B>commitSync</B>() 346 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 347<DL> 348<DD>End the transaction, committing synchronously. This means the 349transaction will exhibit all of the ACID (atomicity, consistency, 350isolation, and durability) properties. 351<p> 352This behavior is the default for database environments unless otherwise 353configured using the <A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnNoSync(boolean)"><CODE>EnvironmentConfig.setTxnNoSync</CODE></A> method. This 354behavior may also be set for a single transaction using the 355<A HREF="../../../com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction</CODE></A> method. Any value specified to 356this method overrides both of those settings. 357<p> 358In the case of nested transactions, if the transaction is a parent 359transaction, committing the parent transaction causes all unresolved 360children of the parent to be committed. In the case of nested 361transactions, if the transaction is a child transaction, its locks are 362not released, but are acquired by its parent. Although the commit of the 363child transaction will succeed, the actual resolution of the child 364transaction is postponed until the parent transaction is committed or 365aborted; that is, if its parent transaction commits, it will be 366committed; and if its parent transaction aborts, it will be aborted. 367<p> 368All cursors opened within the transaction must be closed before the 369transaction is committed. 370<p> 371After this method returns the <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be 372accessed again, regardless of the method's success or failure. If the 373method encounters an error, the transaction and all child transactions 374of the transaction will have been aborted when the call returns. 375<p> 376<p> 377<P> 378<DD><DL> 379 380<DT><B>Throws:</B> 381<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 382</DD> 383</DL> 384<HR> 385 386<A NAME="commitNoSync()"><!-- --></A><H3> 387commitNoSync</H3> 388<PRE> 389public void <B>commitNoSync</B>() 390 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 391<DL> 392<DD>End the transaction, not committing synchronously. 393This means the 394transaction will exhibit the ACI (atomicity, consistency, and isolation) 395properties, but not D (durability); that is, database integrity will be 396maintained, but it is possible this transaction may be undone during 397recovery. 398<p> 399This behavior may be set for a database environment using the 400<A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnNoSync(boolean)"><CODE>EnvironmentConfig.setTxnNoSync</CODE></A> method or for a single transaction 401using the <A HREF="../../../com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction</CODE></A> method. Any value 402specified to this method overrides both of those settings. 403<p> 404In the case of nested transactions, if the transaction is a parent 405transaction, committing the parent transaction causes all unresolved 406children of the parent to be committed. In the case of nested 407transactions, if the transaction is a child transaction, its locks are 408not released, but are acquired by its parent. Although the commit of the 409child transaction will succeed, the actual resolution of the child 410transaction is postponed until the parent transaction is committed or 411aborted; that is, if its parent transaction commits, it will be 412committed; and if its parent transaction aborts, it will be aborted. 413<p> 414All cursors opened within the transaction must be closed before the 415transaction is committed. 416<p> 417After this method returns the <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be 418accessed again, regardless of the method's success or failure. If the 419method encounters an error, the transaction and all child transactions 420of the transaction will have been aborted when the call returns. 421<p> 422<p> 423<P> 424<DD><DL> 425 426<DT><B>Throws:</B> 427<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 428</DD> 429</DL> 430<HR> 431 432<A NAME="commitWriteNoSync()"><!-- --></A><H3> 433commitWriteNoSync</H3> 434<PRE> 435public void <B>commitWriteNoSync</B>() 436 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 437<DL> 438<DD>End the transaction, writing but not flushing the log. 439This means the 440transaction will exhibit the ACI (atomicity, consistency, and isolation) 441properties, but not D (durability); that is, database integrity will be 442maintained, but it is possible this transaction may be undone during 443recovery in the event that the operating system crashes. This option 444provides more durability than an asynchronous commit and has less 445performance cost than a synchronous commit. 446<p> 447This behavior may be set for a database environment using the 448<A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnWriteNoSync(boolean)"><CODE>EnvironmentConfig.setTxnWriteNoSync</CODE></A> method or for a single 449transaction using the <A HREF="../../../com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction</CODE></A> method. 450Any value specified to this method overrides both of those settings. 451<p> 452In the case of nested transactions, if the transaction is a parent 453transaction, committing the parent transaction causes all unresolved 454children of the parent to be committed. In the case of nested 455transactions, if the transaction is a child transaction, its locks are 456not released, but are acquired by its parent. Although the commit of the 457child transaction will succeed, the actual resolution of the child 458transaction is postponed until the parent transaction is committed or 459aborted; that is, if its parent transaction commits, it will be 460committed; and if its parent transaction aborts, it will be aborted. 461<p> 462All cursors opened within the transaction must be closed before the 463transaction is committed. 464<p> 465After this method returns the <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be 466accessed again, regardless of the method's success or failure. If the 467method encounters an error, the transaction and all child transactions 468of the transaction will have been aborted when the call returns. 469<p> 470<p> 471<P> 472<DD><DL> 473 474<DT><B>Throws:</B> 475<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 476</DD> 477</DL> 478<HR> 479 480<A NAME="discard()"><!-- --></A><H3> 481discard</H3> 482<PRE> 483public void <B>discard</B>() 484 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 485<DL> 486<DD>Free up all the per-process resources associated with the specified 487 <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle, neither committing nor aborting the 488 transaction. This call may be used only after calls to 489 <A HREF="../../../com/sleepycat/db/Environment.html#recover(int, boolean)"><CODE>Environment.recover</CODE></A> when there are multiple global 490 transaction managers recovering transactions in a single database 491 environment. Any transactions returned by <A HREF="../../../com/sleepycat/db/Environment.html#recover(int, boolean)"><CODE>Environment.recover</CODE></A> that are not handled by the current global transaction 492 manager should be discarded using this method. 493 <p> 494 The <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be accessed again after this 495 method has been called, regardless of the method's success or failure. 496 <p> 497 <p> 498<P> 499<DD><DL> 500 501<DT><B>Throws:</B> 502<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 503</DD> 504</DL> 505<HR> 506 507<A NAME="getId()"><!-- --></A><H3> 508getId</H3> 509<PRE> 510public int <B>getId</B>() 511 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 512<DL> 513<DD>Return the transaction's unique ID. 514 <p> 515 Locking calls made on behalf of this transaction should use the 516 value returned from this method as the locker parameter to the 517 <A HREF="../../../com/sleepycat/db/Environment.html#getLock(int, boolean, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockRequestMode)"><CODE>Environment.getLock</CODE></A> or <A HREF="../../../com/sleepycat/db/Environment.html#lockVector(int, boolean, com.sleepycat.db.LockRequest[])"><CODE>Environment.lockVector</CODE></A> 518 calls. 519 <p> 520<P> 521<DD><DL> 522 523<DT><B>Returns:</B><DD>The transaction's unique ID. 524 <p> 525 <p> 526<DT><B>Throws:</B> 527<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 528</DD> 529</DL> 530<HR> 531 532<A NAME="getName()"><!-- --></A><H3> 533getName</H3> 534<PRE> 535public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getName</B>() 536 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 537<DL> 538<DD>Get the user visible name for the transaction. 539 <p> 540<P> 541<DD><DL> 542 543<DT><B>Returns:</B><DD>The user visible name for the transaction. 544 <p> 545<DT><B>Throws:</B> 546<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 547</DD> 548</DL> 549<HR> 550 551<A NAME="prepare(byte[])"><!-- --></A><H3> 552prepare</H3> 553<PRE> 554public void <B>prepare</B>(byte[] gid) 555 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 556<DL> 557<DD>Initiate the beginning of a two-phase commit. 558 <p> 559 In a distributed transaction environment, Berkeley DB can be used 560 as a local transaction manager. In this case, the distributed 561 transaction manager must send <em>prepare</em> messages to each 562 local manager. The local manager must then issue a 563 <A HREF="../../../com/sleepycat/db/Transaction.html#prepare(byte[])"><CODE>Transaction.prepare</CODE></A> call and await its successful return 564 before responding to the distributed transaction manager. Only 565 after the distributed transaction manager receives successful 566 responses from all of its <em>prepare</em> messages should it issue 567 any <em>commit</em> messages. 568 <p> 569 In the case of nested transactions, preparing the parent causes all 570 unresolved children of the parent transaction to be committed. 571 Child transactions should never be explicitly prepared. Their fate 572 will be resolved along with their parent's during global recovery. 573 <p> 574<P> 575<DD><DL> 576<DT><B>Parameters:</B><DD><CODE>gid</CODE> - The global transaction ID by which this transaction will be known. 577 This global transaction ID will be returned in calls to 578 <A HREF="../../../com/sleepycat/db/Environment.html#recover(int, boolean)"><CODE>Environment.recover</CODE></A> method, telling the application which 579 global transactions must be resolved. The gid parameter must be sized 580 at least DB_XIDDATASIZE (currently 128) bytes; only the first 581 DB_XIDDATASIZE bytes are used. 582 <p> 583 <p> 584<DT><B>Throws:</B> 585<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 586</DD> 587</DL> 588<HR> 589 590<A NAME="setName(java.lang.String)"><!-- --></A><H3> 591setName</H3> 592<PRE> 593public void <B>setName</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name) 594 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 595<DL> 596<DD>Set the user visible name for the transaction. 597 <p> 598<P> 599<DD><DL> 600<DT><B>Parameters:</B><DD><CODE>name</CODE> - The user visible name for the transaction. 601 <p> 602<DT><B>Throws:</B> 603<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> 604</DD> 605</DL> 606<HR> 607 608<A NAME="setTxnTimeout(long)"><!-- --></A><H3> 609setTxnTimeout</H3> 610<PRE> 611public void <B>setTxnTimeout</B>(long timeOut) 612 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 613<DL> 614<DD>Configure the timeout value for the transaction lifetime. 615 <p> 616 If the transaction runs longer than this time, the transaction may 617 may throw <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><CODE>DatabaseException</CODE></A>. 618 <p> 619 Timeouts are checked whenever a thread of control blocks on a lock 620 or when deadlock detection is performed. For this reason, the 621 accuracy of the timeout depends on how often deadlock detection is 622 performed. 623 <p> 624<P> 625<DD><DL> 626<DT><B>Parameters:</B><DD><CODE>timeOut</CODE> - The timeout value for the transaction lifetime, in microseconds. As 627 the value is an unsigned 32-bit number of microseconds, the maximum 628 timeout is roughly 71 minutes. A value of 0 disables timeouts for 629 the transaction. 630 <p> 631 This method may be called at any time during the life of the application. 632 <p> 633 <p> 634<DT><B>Throws:</B> 635<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 636</DD> 637</DL> 638<HR> 639 640<A NAME="setLockTimeout(long)"><!-- --></A><H3> 641setLockTimeout</H3> 642<PRE> 643public void <B>setLockTimeout</B>(long timeOut) 644 throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> 645<DL> 646<DD>Configure the lock request timeout value for the transaction. 647 <p> 648 If a lock request cannot be granted in this time, the transaction 649 may throw <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><CODE>DatabaseException</CODE></A>. 650 <p> 651 Timeouts are checked whenever a thread of control blocks on a lock 652 or when deadlock detection is performed. For this reason, the 653 accuracy of the timeout depends on how often deadlock detection is 654 performed. 655 <p> 656<P> 657<DD><DL> 658<DT><B>Parameters:</B><DD><CODE>timeOut</CODE> - The lock request timeout value for the transaction, in microseconds. 659 As the value is an unsigned 32-bit number of microseconds, the maximum 660 timeout is roughly 71 minutes. A value of 0 disables timeouts for the 661 transaction. 662 <p> 663 This method may be called at any time during the life of the application. 664 <p> 665 <p> 666<DT><B>Throws:</B> 667<DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> 668</DD> 669</DL> 670<!-- ========= END OF CLASS DATA ========= --> 671<HR> 672 673 674<!-- ======= START OF BOTTOM NAVBAR ====== --> 675<A NAME="navbar_bottom"><!-- --></A> 676<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 677<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 678<TR> 679<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 680<A NAME="navbar_bottom_firstrow"><!-- --></A> 681<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 682 <TR ALIGN="center" VALIGN="top"> 683 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 684 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 685 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 686 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Transaction.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 687 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 688 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 689 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 690 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 691 </TR> 692</TABLE> 693</TD> 694<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 695<b>Berkeley DB</b><br><font size="-1"> version 4.7.25</font></EM> 696</TD> 697</TR> 698 699<TR> 700<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 701 <A HREF="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> 702 <A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> 703<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 704 <A HREF="../../../index.html?com/sleepycat/db/Transaction.html" target="_top"><B>FRAMES</B></A> 705 <A HREF="Transaction.html" target="_top"><B>NO FRAMES</B></A> 706 <SCRIPT type="text/javascript"> 707 <!-- 708 if(window==top) { 709 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); 710 } 711 //--> 712</SCRIPT> 713<NOSCRIPT> 714 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> 715</NOSCRIPT> 716 717 718</FONT></TD> 719</TR> 720<TR> 721<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 722 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> 723<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 724DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> 725</TR> 726</TABLE> 727<A NAME="skip-navbar_bottom"></A> 728<!-- ======== END OF BOTTOM NAVBAR ======= --> 729 730<HR> 731<font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 732</BODY> 733</HTML> 734