<!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_0) on Wed Dec 30 04:50:32 EST 2009 --> <TITLE> Transaction </TITLE> <META NAME="date" CONTENT="2009-12-30"> <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="Transaction"; } } </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/StatsConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/TransactionConfig.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/Transaction.html" target="_top"><B>FRAMES</B></A> <A HREF="Transaction.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <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 Transaction</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.db.Transaction</B> </PRE> <HR> <DL> <DT><PRE>public class <B>Transaction</B><DT>extends java.lang.Object</DL> </PRE> <P> The Transaction object is the handle for a transaction. Methods off the transaction handle are used to configure, abort and commit the transaction. Transaction handles are provided to other Berkeley DB methods in order to transactionally protect those operations. <p> Transaction 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 handle. Once the <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 <A HREF="../../../com/sleepycat/db/Transaction.html#discard()"><CODE>Transaction.discard</CODE></A> methods are called, the handle may not be accessed again, regardless of the success or failure of the method. 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/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>. <p> To obtain a transaction with default attributes: <blockquote><pre> Transaction txn = myEnvironment.beginTransaction(null, null); </pre></blockquote> To customize the attributes of a transaction: <blockquote><pre> TransactionConfig config = new TransactionConfig(); config.setDirtyRead(true); Transaction txn = myEnvironment.beginTransaction(null, config); </pre></blockquote> <P> <P> <HR> <P> <!-- ========== 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/Transaction.html#abort()">abort</A></B>()</CODE> <BR> Cause 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/Transaction.html#commit()">commit</A></B>()</CODE> <BR> End 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/Transaction.html#commitNoSync()">commitNoSync</A></B>()</CODE> <BR> End the transaction, not committing synchronously.</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/Transaction.html#commitSync()">commitSync</A></B>()</CODE> <BR> End the transaction, committing synchronously.</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/Transaction.html#commitWriteNoSync()">commitWriteNoSync</A></B>()</CODE> <BR> End the transaction, writing but not flushing the log.</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/Transaction.html#discard()">discard</A></B>()</CODE> <BR> Free up all the per-process resources associated with the specified <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</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> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#getId()">getId</A></B>()</CODE> <BR> Return the transaction's unique ID.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/Transaction.html#getName()">getName</A></B>()</CODE> <BR> Get the user visible name for 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/Transaction.html#prepare(byte[])">prepare</A></B>(byte[] gid)</CODE> <BR> Initiate 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/Transaction.html#setLockTimeout(long)">setLockTimeout</A></B>(long timeOut)</CODE> <BR> Configure the lock request timeout value for 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/Transaction.html#setName(java.lang.String)">setName</A></B>(java.lang.String name)</CODE> <BR> Set the user visible name for 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/Transaction.html#setTxnTimeout(long)">setTxnTimeout</A></B>(long timeOut)</CODE> <BR> Configure the timeout value for the transaction lifetime.</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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <P> <!-- ============ 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="abort()"><!-- --></A><H3> abort</H3> <PRE> public void <B>abort</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Cause an abnormal termination of the transaction. <p> The log is played backward, and any necessary undo operations are done. Before Transaction.abort returns, any locks held by the transaction will have been released. <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> All cursors opened within the transaction must be closed before the transaction is aborted. <p> After Transaction.abort has been called, regardless of its return, the <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle may not be accessed again. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="commit()"><!-- --></A><H3> commit</H3> <PRE> public void <B>commit</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>End the transaction. If the environment is configured for synchronous commit, the transaction will be committed synchronously to stable storage before the call returns. This means the transaction will exhibit all of the ACID (atomicity, consistency, isolation, and durability) properties. <p> If the environment is not configured for synchronous commit, the commit will not necessarily have been committed to stable storage before the call returns. 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 this transaction may be undone during recovery. <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> All cursors opened within the transaction must be closed before the transaction is committed. <p> After 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 accessed again, regardless of the method's success or failure. If the method encounters an error, the transaction and all child transactions of the transaction will have been aborted when the call returns. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="commitSync()"><!-- --></A><H3> commitSync</H3> <PRE> public void <B>commitSync</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>End the transaction, committing synchronously. This means the transaction will exhibit all of the ACID (atomicity, consistency, isolation, and durability) properties. <p> This behavior is the default for database environments unless otherwise configured using the <A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnNoSync(boolean)"><CODE>EnvironmentConfig.setTxnNoSync</CODE></A> method. This behavior may also be set for a single transaction using 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 specified to this method overrides both of those settings. <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> All cursors opened within the transaction must be closed before the transaction is committed. <p> After 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 accessed again, regardless of the method's success or failure. If the method encounters an error, the transaction and all child transactions of the transaction will have been aborted when the call returns. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="commitNoSync()"><!-- --></A><H3> commitNoSync</H3> <PRE> public void <B>commitNoSync</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>End the transaction, not committing synchronously. 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 this transaction may be undone during recovery. <p> This behavior may be set for a database environment using the <A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnNoSync(boolean)"><CODE>EnvironmentConfig.setTxnNoSync</CODE></A> method or for a single transaction using 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 specified to this method overrides both of those settings. <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> All cursors opened within the transaction must be closed before the transaction is committed. <p> After 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 accessed again, regardless of the method's success or failure. If the method encounters an error, the transaction and all child transactions of the transaction will have been aborted when the call returns. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="commitWriteNoSync()"><!-- --></A><H3> commitWriteNoSync</H3> <PRE> public void <B>commitWriteNoSync</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>End the transaction, writing but not flushing 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 this transaction may be undone during recovery in the event that the operating system crashes. This option provides more durability than an asynchronous commit and has less performance cost than a synchronous commit. <p> This behavior may be set for a database environment using the <A HREF="../../../com/sleepycat/db/EnvironmentConfig.html#setTxnWriteNoSync(boolean)"><CODE>EnvironmentConfig.setTxnWriteNoSync</CODE></A> method or for a single transaction using 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 specified to this method overrides both of those settings. <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> All cursors opened within the transaction must be closed before the transaction is committed. <p> After 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 accessed again, regardless of the method's success or failure. If the method encounters an error, the transaction and all child transactions of the transaction will have been aborted when the call returns. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="discard()"><!-- --></A><H3> discard</H3> <PRE> public void <B>discard</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Free up all the per-process resources associated with the specified <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db"><CODE>Transaction</CODE></A> handle, neither committing nor aborting the transaction. This call may be used only after calls to <A HREF="../../../com/sleepycat/db/Environment.html#recover(int, boolean)"><CODE>Environment.recover</CODE></A> when there are multiple global transaction managers recovering transactions in a single database 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 manager should be discarded using this method. <p> 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 method has been called, regardless of the method's success or failure. <p> <p> <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="getId()"><!-- --></A><H3> getId</H3> <PRE> public int <B>getId</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Return the transaction's unique ID. <p> Locking calls made on behalf of this transaction should use the value returned from this method as the locker parameter to the <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> calls. <p> <P> <DD><DL> <DT><B>Returns:</B><DD>The transaction's unique ID. <p> <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="getName()"><!-- --></A><H3> getName</H3> <PRE> public java.lang.String <B>getName</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Get the user visible name for the transaction. <p> <P> <DD><DL> <DT><B>Returns:</B><DD>The user visible name for the transaction. <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></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/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Initiate the beginning of a two-phase commit. <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 <em>prepare</em> messages to each local manager. The local manager must then issue a <A HREF="../../../com/sleepycat/db/Transaction.html#prepare(byte[])"><CODE>Transaction.prepare</CODE></A> call 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 <em>prepare</em> messages should it issue any <em>commit</em> messages. <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> - 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/Environment.html#recover(int, boolean)"><CODE>Environment.recover</CODE></A> method, telling the application which global transactions must be resolved. The gid parameter must be sized at least DB_XIDDATASIZE (currently 128) bytes; only the first DB_XIDDATASIZE bytes are used. <p> <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="setName(java.lang.String)"><!-- --></A><H3> setName</H3> <PRE> public void <B>setName</B>(java.lang.String name) throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Set the user visible name for the transaction. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>name</CODE> - The user visible name for the transaction. <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE></DL> </DD> </DL> <HR> <A NAME="setTxnTimeout(long)"><!-- --></A><H3> setTxnTimeout</H3> <PRE> public void <B>setTxnTimeout</B>(long timeOut) throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Configure the timeout value for the transaction lifetime. <p> If the transaction runs longer than this time, the transaction may may throw <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><CODE>DatabaseException</CODE></A>. <p> Timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. For this reason, the accuracy of the timeout depends on how often deadlock detection is performed. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>timeOut</CODE> - The timeout value for the transaction lifetime, in microseconds. As the value is an unsigned 32-bit number of microseconds, the maximum timeout is roughly 71 minutes. A value of 0 disables timeouts for the transaction. <p> This method may be called at any time during the life of the application. <p> <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</DL> </DD> </DL> <HR> <A NAME="setLockTimeout(long)"><!-- --></A><H3> setLockTimeout</H3> <PRE> public void <B>setLockTimeout</B>(long timeOut) throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></PRE> <DL> <DD>Configure the lock request timeout value for the transaction. <p> If a lock request cannot be granted in this time, the transaction may throw <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><CODE>DatabaseException</CODE></A>. <p> Timeouts are checked whenever a thread of control blocks on a lock or when deadlock detection is performed. For this reason, the accuracy of the timeout depends on how often deadlock detection is performed. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>timeOut</CODE> - The lock request timeout value for the transaction, in microseconds. As the value is an unsigned 32-bit number of microseconds, the maximum timeout is roughly 71 minutes. A value of 0 disables timeouts for the transaction. <p> This method may be called at any time during the life of the application. <p> <p> <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if a failure occurs.</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/StatsConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/TransactionConfig.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/Transaction.html" target="_top"><B>FRAMES</B></A> <A HREF="Transaction.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 | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>