<!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:39 UTC 2010 --> <TITLE> CurrentTransaction </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="CurrentTransaction"; } } </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"> PREV CLASS <A HREF="../../../com/sleepycat/bdb/DataCursor.html" title="class in com.sleepycat.bdb"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/bdb/CurrentTransaction.html" target="_top"><B>FRAMES</B></A> <A HREF="CurrentTransaction.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.bdb</FONT> <BR> Class CurrentTransaction</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.bdb.CurrentTransaction</B> </PRE> <HR> <DL> <DT><PRE>public class <B>CurrentTransaction</B><DT>extends java.lang.Object</DL> </PRE> <P> Provides access to the current transaction for the current thread within the context of a Berkeley DB environment. This class provides explicit transaction control beyond that provided by the <A HREF="../../../com/sleepycat/bdb/TransactionRunner.html" title="class in com.sleepycat.bdb"><CODE>TransactionRunner</CODE></A> class. However, both methods of transaction control manage per-thread transactions. <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> <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#abortTxn()">abortTxn</A></B>()</CODE> <BR> Aborts the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#beginTxn()">beginTxn</A></B>()</CODE> <BR> Begins a new transaction for this environment and associates it with the current thread.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#beginTxn(boolean, boolean)">beginTxn</A></B>(boolean dirtyRead, boolean noWait)</CODE> <BR> Begins a new transaction for this environment and associates it with the current thread.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#commitTxn()">commitTxn</A></B>()</CODE> <BR> Commits the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../com/sleepycat/db/DbEnv.html" title="class in com.sleepycat.db">DbEnv</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#getEnv()">getEnv</A></B>()</CODE> <BR> Returns the underlying Berkeley DB environment.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html" title="class in com.sleepycat.bdb">CurrentTransaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#getInstance(com.sleepycat.db.DbEnv)">getInstance</A></B>(<A HREF="../../../com/sleepycat/db/DbEnv.html" title="class in com.sleepycat.db">DbEnv</A> env)</CODE> <BR> Gets the CurrentTransaction accessor for a specified Berkeley DB environment.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html#getTxn()">getTxn</A></B>()</CODE> <BR> Returns the transaction associated with the current thread for this environment, or null if no transaction is active.</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/bdb/CurrentTransaction.html#isAutoCommit()">isAutoCommit</A></B>()</CODE> <BR> Returns whether AUTO_COMMIT will be used for all non-cursor write operations when no transaction is active.</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/bdb/CurrentTransaction.html#isDirtyRead()">isDirtyRead</A></B>()</CODE> <BR> Returns whether dirty-read is used for the current 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/bdb/CurrentTransaction.html#isNoWait()">isNoWait</A></B>()</CODE> <BR> Returns whether no-wait is used for the current 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, 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="getInstance(com.sleepycat.db.DbEnv)"><!-- --></A><H3> getInstance</H3> <PRE> public static <A HREF="../../../com/sleepycat/bdb/CurrentTransaction.html" title="class in com.sleepycat.bdb">CurrentTransaction</A> <B>getInstance</B>(<A HREF="../../../com/sleepycat/db/DbEnv.html" title="class in com.sleepycat.db">DbEnv</A> env)</PRE> <DL> <DD>Gets the CurrentTransaction accessor for a specified Berkeley DB environment. This method always returns the same reference when called more than once with the same environment parameter. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>env</CODE> - is an open Berkeley DB environment. <DT><B>Returns:</B><DD>the CurrentTransaction accessor for the given environment, or null if the environment is not transactional.</DL> </DD> </DL> <HR> <A NAME="getEnv()"><!-- --></A><H3> getEnv</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbEnv.html" title="class in com.sleepycat.db">DbEnv</A> <B>getEnv</B>()</PRE> <DL> <DD>Returns the underlying Berkeley DB environment. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="isAutoCommit()"><!-- --></A><H3> isAutoCommit</H3> <PRE> public final boolean <B>isAutoCommit</B>()</PRE> <DL> <DD>Returns whether AUTO_COMMIT will be used for all non-cursor write operations when no transaction is active. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="isDirtyRead()"><!-- --></A><H3> isDirtyRead</H3> <PRE> public final boolean <B>isDirtyRead</B>()</PRE> <DL> <DD>Returns whether dirty-read is used for the current transaction. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="isNoWait()"><!-- --></A><H3> isNoWait</H3> <PRE> public final boolean <B>isNoWait</B>()</PRE> <DL> <DD>Returns whether no-wait is used for the current transaction. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getTxn()"><!-- --></A><H3> getTxn</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> <B>getTxn</B>()</PRE> <DL> <DD>Returns the transaction associated with the current thread for this environment, or null if no transaction is active. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="beginTxn()"><!-- --></A><H3> beginTxn</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> <B>beginTxn</B>() throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>Begins a new transaction for this environment and associates it with the current thread. If a transaction is already active for this environment and thread, a nested transaction will be created. <P> <DD><DL> <DT><B>Returns:</B><DD>the new transaction. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - if the transaction cannot be started, in which case any existing transaction is not affected.</DL> </DD> </DL> <HR> <A NAME="beginTxn(boolean, boolean)"><!-- --></A><H3> beginTxn</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> <B>beginTxn</B>(boolean dirtyRead, boolean noWait) throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></PRE> <DL> <DD>Begins a new transaction for this environment and associates it with the current thread. If a transaction is already active for this environment and thread, a nested transaction will be created. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>dirtyRead</CODE> - true if this transaction should read data that is modified by another transaction but not committed.<DD><CODE>noWait</CODE> - true if this transaction should throw DbLockNotGrantedException instead of blocking when trying to access data that is locked by another transaction. <DT><B>Returns:</B><DD>the new transaction. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - if the transaction cannot be started, in which case any existing transaction is not affected.</DL> </DD> </DL> <HR> <A NAME="commitTxn()"><!-- --></A><H3> commitTxn</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> <B>commitTxn</B>() throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A>, java.lang.IllegalStateException</PRE> <DL> <DD>Commits the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. <P> <DD><DL> <DT><B>Returns:</B><DD>the parent transaction or null if the committed transaction was not nested. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - if an error occurs commiting the transaction. The transaction will still be closed and the parent transaction will become the current transaction. <DD><CODE>java.lang.IllegalStateException</CODE> - if no transaction is active for the current thread for this environement.</DL> </DD> </DL> <HR> <A NAME="abortTxn()"><!-- --></A><H3> abortTxn</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/DbTxn.html" title="class in com.sleepycat.db">DbTxn</A> <B>abortTxn</B>() throws <A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A>, java.lang.IllegalStateException</PRE> <DL> <DD>Aborts the transaction that is active for the current thread for this environment and makes the parent transaction (if any) the current transaction. <P> <DD><DL> <DT><B>Returns:</B><DD>the parent transaction or null if the aborted transaction was not nested. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DbException.html" title="class in com.sleepycat.db">DbException</A></CODE> - if an error occurs aborting the transaction. The transaction will still be closed and the parent transaction will become the current transaction. <DD><CODE>java.lang.IllegalStateException</CODE> - if no transaction is active for the current thread for this environement.</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"> PREV CLASS <A HREF="../../../com/sleepycat/bdb/DataCursor.html" title="class in com.sleepycat.bdb"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/bdb/CurrentTransaction.html" target="_top"><B>FRAMES</B></A> <A HREF="CurrentTransaction.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>