<!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.6.0_18) on Thu Dec 02 16:59:42 UTC 2010 --> <TITLE> DbTxn </TITLE> <META NAME="date" CONTENT="2010-12-02"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DbTxn"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= 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="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> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/sleepycat/db/Dbt.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/DbTxnStat.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/db/DbTxn.html" target="_top"><B>FRAMES</B></A> <A HREF="DbTxn.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.db</FONT> <BR> Class DbTxn</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.db.DbTxn</B> </PRE> <HR> <DL> <DT><PRE>public class <B>DbTxn</B><DT>extends java.lang.Object</DL> </PRE> <P> The DbTxn object is the handle for a transaction. Methods off the DbTxn handle are used to configure, abort and commit the transaction. DbTxn handles are provided to <A HREF="../../../com/sleepycat/db/Db.html" title="class in com.sleepycat.db"><CODE>Db</CODE></A> methods in order to transactionally protect those database operations.</p> <p> DbTxn handles are not free-threaded; transactions handles may be used by multiple threads, but only serially, that is, the application must serialize access to the DbTxn handle. Once the <A HREF="../../../com/sleepycat/db/DbTxn.html#abort()"><CODE>DbTxn.abort</CODE></A> or <A HREF="../../../com/sleepycat/db/DbTxn.html#commit(int)"><CODE>DbTxn.commit</CODE></A> methods are called, the handle may not be accessed again, regardless of the method's return. In addition, parent transactions may not issue any Berkeley DB operations while they have active child transactions (child transactions that have not yet been committed or aborted) except for <A HREF="../../../com/sleepycat/db/DbEnv.html#txnBegin(com.sleepycat.db.DbTxn, int)"><CODE>DbEnv.txnBegin</CODE></A>, <A HREF="../../../com/sleepycat/db/DbTxn.html#abort()"><CODE>DbTxn.abort</CODE></A> and <A HREF="../../../com/sleepycat/db/DbTxn.html#commit(int)"><CODE>DbTxn.commit</CODE></A>.</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>protected boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#swigCMemOwn">swigCMemOwn</A></B></CODE> <BR> </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 ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#DbTxn()">DbTxn</A></B>()</CODE> <BR> </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#DbTxn(long, boolean)">DbTxn</A></B>(long cPtr, boolean cMemoryOwn)</CODE> <BR> </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> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#abort()">abort</A></B>()</CODE> <BR> The DbTxn.abort method causes an abnormal termination of the 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/db/DbTxn.html#commit(int)">commit</A></B>(int flags)</CODE> <BR> The DbTxn.commit method ends the transaction.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#delete()">delete</A></B>()</CODE> <BR> </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/db/DbTxn.html#discard(int)">discard</A></B>(int flags)</CODE> <BR> The DbTxn.discard method frees up all the per-process resources associated with the specified <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle, neither committing nor aborting the transaction.</TD> </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/db/DbTxn.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object obj)</CODE> <BR> </TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>protected static long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DbTxn.html#getCPtr(com.sleepycat.db.DbTxn)">getCPtr</A></B>(<A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> obj)</CODE> <BR> </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/db/DbTxn.html#hashCode()">hashCode</A></B>()</CODE> <BR> </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/db/DbTxn.html#id()">id</A></B>()</CODE> <BR> The DbTxn.id method returns the unique transaction id associated with the specified 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/db/DbTxn.html#prepare(byte[])">prepare</A></B>(byte[] gid)</CODE> <BR> The DbTxn.prepare method initiates the beginning of a two-phase commit.</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/db/DbTxn.html#set_timeout(long, int)">set_timeout</A></B>(long timeout, int flags)</CODE> <BR> <B>Deprecated.</B> <I>As of Berkeley DB 4.2, replaced by <A HREF="../../../com/sleepycat/db/DbTxn.html#setTimeout(long, int)"><CODE>setTimeout(long,int)</CODE></A></I></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/db/DbTxn.html#setTimeout(long, int)">setTimeout</A></B>(long timeout, int flags)</CODE> <BR> The DbTxn.setTimeout method sets timeout values for locks or transactions for the specified transaction.</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.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait</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="swigCMemOwn"><!-- --></A><H3> swigCMemOwn</H3> <PRE> protected boolean <B>swigCMemOwn</B></PRE> <DL> <DL> </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="DbTxn(long, boolean)"><!-- --></A><H3> DbTxn</H3> <PRE> protected <B>DbTxn</B>(long cPtr, boolean cMemoryOwn)</PRE> <DL> </DL> <HR> <A NAME="DbTxn()"><!-- --></A><H3> DbTxn</H3> <PRE> protected <B>DbTxn</B>()</PRE> <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="delete()"><!-- --></A><H3> delete</H3> <PRE> protected void <B>delete</B>()</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getCPtr(com.sleepycat.db.DbTxn)"><!-- --></A><H3> getCPtr</H3> <PRE> protected static long <B>getCPtr</B>(<A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> obj)</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="abort()"><!-- --></A><H3> abort</H3> <PRE> public void <B>abort</B>() throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.abort method causes an abnormal termination of the transaction. The log is played backward, and any necessary undo operations are done through the <b>tx_recover</b> function specified to <A HREF="../../../com/sleepycat/db/DbEnv.html#setAppDispatch(com.sleepycat.db.DbAppDispatch)"><CODE>DbEnv.setAppDispatch</CODE></A>. Before DbTxn.abort returns, any locks held by the transaction will have been released.</p> <p> In the case of nested transactions, aborting a parent transaction causes all children (unresolved or not) of the parent transaction to be aborted.</p> <p> All cursors opened within the transaction must be closed before the transaction is aborted.</p> <p> After DbTxn.abort has been called, regardless of its return, the <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle may not be accessed again.</p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - Signals that an exception of some sort has occurred.</DL> </DD> </DL> <HR> <A NAME="commit(int)"><!-- --></A><H3> commit</H3> <PRE> public void <B>commit</B>(int flags) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.commit method ends the transaction.</p> <p> In the case of nested transactions, if the transaction is a parent transaction, committing the parent transaction causes all unresolved children of the parent to be committed. In the case of nested transactions, if the transaction is a child transaction, its locks are not released, but are acquired by its parent. Although the commit of the child transaction will succeed, the actual resolution of the child transaction is postponed until the parent transaction is committed or aborted; that is, if its parent transaction commits, it will be committed; and if its parent transaction aborts, it will be aborted.</p> <p> All cursors opened within the transaction must be closed before the transaction is committed.</p> <p> After DbTxn.commit has been called, regardless of its return, the <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle may not be accessed again. If DbTxn.commit encounters an error, the transaction and all child transactions of the transaction are aborted.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>flags</CODE> - must be set to 0 or one of the following values: <ul> <li> <A HREF="../../../com/sleepycat/db/Db.html#DB_TXN_NOSYNC"><CODE>Db.DB_TXN_NOSYNC</CODE></A><p> Do not synchronously flush the log. This means the transaction will exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but it is possible that this transaction may be undone during recovery. <p> This behavior may be set for a Berkeley DB environment using the <A HREF="../../../com/sleepycat/db/DbEnv.html#setFlags(int, boolean)"><CODE>DbEnv.setFlags</CODE></A> method or for a single transaction using the <A HREF="../../../com/sleepycat/db/DbEnv.html#txnBegin(com.sleepycat.db.DbTxn, int)"><CODE>DbEnv.txnBegin</CODE></A> method. Any value specified to this method overrides both of those settings.</p> </li> </ul> <ul> <li> <A HREF="../../../com/sleepycat/db/Db.html#DB_TXN_SYNC"><CODE>Db.DB_TXN_SYNC</CODE></A><p> Synchronously flush the log. This means the transaction will exhibit all of the ACID (atomicity, consistency, isolation, and durability) properties. <p> This behavior is the default for Berkeley DB environments unless the <A HREF="../../../com/sleepycat/db/Db.html#DB_TXN_NOSYNC"><CODE><code>Db.DB_TXN_NOSYNC</code> </CODE></A> flag was specified to the <A HREF="../../../com/sleepycat/db/DbEnv.html#setFlags(int, boolean)"><CODE>DbEnv.setFlags</CODE></A> method. This behavior may also be set for a single transaction using the <A HREF="../../../com/sleepycat/db/DbEnv.html#txnBegin(com.sleepycat.db.DbTxn, int)"><CODE>DbEnv.txnBegin</CODE></A> method. Any value specified to this method overrides both of those settings.</p> </li> </ul> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - Signals that an exception of some sort has occurred.</DL> </DD> </DL> <HR> <A NAME="discard(int)"><!-- --></A><H3> discard</H3> <PRE> public void <B>discard</B>(int flags) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.discard method frees up all the per-process resources associated with the specified <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle, neither committing nor aborting the transaction. This call may be used only after calls to <A HREF="../../../com/sleepycat/db/DbEnv.html#txnRecover(int, int)"><CODE>DbEnv.txnRecover</CODE></A> when there are multiple global transaction managers recovering transactions in a single Berkeley DB environment. Any transactions returned by <A HREF="../../../com/sleepycat/db/DbEnv.html#txnRecover(int, int)"><CODE>DbEnv.txnRecover</CODE></A> that are not handled by the current global transaction manager should be discarded using DbTxn.discard.</p> After DbTxn.discard has been called, regardless of its return, the <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle may not be accessed again.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>flags</CODE> - currently unused, and must be set to 0. <DT><B>Throws:</B> <DD><CODE>java.lang.IllegalArgumentException</CODE> - The DbTxn.discard method will fail and throw a IllegalArgumentException exception if the transaction handle does not refer to a transaction that was recovered into a prepared but not yet completed state; or if an invalid flag value or parameter was specified. <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE></DL> </DD> </DL> <HR> <A NAME="equals(java.lang.Object)"><!-- --></A><H3> equals</H3> <PRE> public boolean <B>equals</B>(java.lang.Object obj)</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE>equals</CODE> in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="hashCode()"><!-- --></A><H3> hashCode</H3> <PRE> public int <B>hashCode</B>()</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE>hashCode</CODE> in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="id()"><!-- --></A><H3> id</H3> <PRE> public int <B>id</B>() throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.id method returns the unique transaction id associated with the specified transaction. Locking calls made on behalf of this transaction should use the value returned from DbTxn.id as the locker parameter to the <A HREF="../../../com/sleepycat/db/DbEnv.html#lockGet(int, int, com.sleepycat.db.Dbt, int)"><CODE>DbEnv.lockGet</CODE></A> or <A HREF="../../../com/sleepycat/db/DbEnv.html#lockVector(int, int, com.sleepycat.db.DbLockRequest[], int, int)"><CODE>DbEnv.lockVector</CODE></A> calls.</p> <P> <DD><DL> <DT><B>Returns:</B><DD>The DbTxn.id method returns the unique transaction id associated with the specified transaction. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - Signals that an exception of some sort has occurred.</DL> </DD> </DL> <HR> <A NAME="prepare(byte[])"><!-- --></A><H3> prepare</H3> <PRE> public void <B>prepare</B>(byte[] gid) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.prepare method initiates the beginning of a two-phase commit.</p> <p> In a distributed transaction environment, Berkeley DB can be used as a local transaction manager. In this case, the distributed transaction manager must send <i>prepare</i> messages to each local manager. The local manager must then issue a DbTxn.prepare and await its successful return before responding to the distributed transaction manager. Only after the distributed transaction manager receives successful responses from all of its <i>prepare</i> messages should it issue any <i>commit</i> messages.</p> <p> In the case of nested transactions, preparing the parent causes all unresolved children of the parent transaction to be committed. Child transactions should never be explicitly prepared. Their fate will be resolved along with their parent's during global recovery.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>gid</CODE> - specifies the global transaction ID by which this transaction will be known. This global transaction ID will be returned in calls to <A HREF="../../../com/sleepycat/db/DbEnv.html#txnRecover(int, int)"><CODE>DbEnv.txnRecover</CODE></A>, telling the application which global transactions must be resolved. <ul> <li> <A HREF="../../../com/sleepycat/db/Db.html#DB_XIDDATASIZE"><CODE>Db.DB_XIDDATASIZE</CODE></A><p> must be sized at least <code>Db.DB_XIDDATASIZE</code> (currently 128) bytes; only the first <code>Db.DB_XIDDATASIZE</code> bytes are used. </li> </ul> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - Signals that an exception of some sort has occurred.</DL> </DD> </DL> <HR> <A NAME="set_timeout(long, int)"><!-- --></A><H3> set_timeout</H3> <PRE> public void <B>set_timeout</B>(long timeout, int flags) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD><B>Deprecated.</B> <I>As of Berkeley DB 4.2, replaced by <A HREF="../../../com/sleepycat/db/DbTxn.html#setTimeout(long, int)"><CODE>setTimeout(long,int)</CODE></A></I> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE></DL> </DD> </DL> <HR> <A NAME="setTimeout(long, int)"><!-- --></A><H3> setTimeout</H3> <PRE> public void <B>setTimeout</B>(long timeout, int flags) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>The DbTxn.setTimeout method sets timeout values for locks or transactions for the specified transaction.</p> <p> Timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. (In the case of Db.DB_SET_LOCK_TIMEOUT, the lock is one requested explicitly through the Lock subsystem interfaces. In the case of Db.DB_SET_TXN_TIMEOUT, the lock is one requested on behalf of a transaction. In either case, it may be a lock requested by the database access methods underlying the application.) As timeouts are only checked when the lock request first blocks or when deadlock detection is performed, the accuracy of the timeout depends on how often deadlock detection is performed. </p> <p> Timeout values may be specified for the database environment as a whole. See <A HREF="../../../com/sleepycat/db/DbEnv.html#setTimeout(long, int)"><CODE>DbEnv.setTimeout</CODE></A> and for more information.</p> <p> The DbTxn.setTimeout method configures operations performed on the underlying transaction, not only operations performed using the specified <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db"><CODE>DbTxn</CODE></A> handle.</p> <p> The DbTxn.setTimeout method may be called at any time during the life of the application.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>flags</CODE> - must be set to one of the following values: <ul> <li> <A HREF="../../../com/sleepycat/db/Db.html#DB_SET_LOCK_TIMEOUT"><CODE>Db.DB_SET_LOCK_TIMEOUT</CODE></A><p> Set the timeout value for locks in this transaction. </li> </ul> <ul> <li> <A HREF="../../../com/sleepycat/db/Db.html#DB_SET_TXN_TIMEOUT"><CODE>Db.DB_SET_TXN_TIMEOUT</CODE></A><p> Set the timeout value for this transaction. </li> </ul><DD><CODE>timeout</CODE> - specified as an unsigned 32-bit number of microseconds, limiting the maximum timeout to roughly 71 minutes. A value of 0 disables timeouts for the transaction. <DT><B>Throws:</B> <DD><CODE>java.lang.IllegalArgumentException</CODE> - The DbTxn.setTimeout method will fail and throw a IllegalArgumentException exception if an invalid flag value or parameter was specified. <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</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="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> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/sleepycat/db/Dbt.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/DbTxnStat.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/db/DbTxn.html" target="_top"><B>FRAMES</B></A> <A HREF="DbTxn.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> </BODY> </HTML>