<!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 Feb 11 22:24:07 EST 2009 --> <TITLE> CurrentTransaction </TITLE> <META NAME="date" CONTENT="2009-02-11"> <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/collections/MapEntryParameter.html" title="class in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/collections/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.collections</FONT> <BR> Class CurrentTransaction</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.collections.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/collections/TransactionRunner.html" title="class in com.sleepycat.collections"><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/Transaction.html" title="class in com.sleepycat.db">Transaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#abortTransaction()">abortTransaction</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/Transaction.html" title="class in com.sleepycat.db">Transaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#beginTransaction(com.sleepycat.db.TransactionConfig)">beginTransaction</A></B>(<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config)</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/Transaction.html" title="class in com.sleepycat.db">Transaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#commitTransaction()">commitTransaction</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/Environment.html" title="class in com.sleepycat.db">Environment</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#getEnvironment()">getEnvironment</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/collections/CurrentTransaction.html" title="class in com.sleepycat.collections">CurrentTransaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#getInstance(com.sleepycat.db.Environment)">getInstance</A></B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</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/Transaction.html" title="class in com.sleepycat.db">Transaction</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/collections/CurrentTransaction.html#getTransaction()">getTransaction</A></B>()</CODE> <BR> Returns the transaction associated with the current thread for this environment, or null if no transaction is active.</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.Environment)"><!-- --></A><H3> getInstance</H3> <PRE> public static <A HREF="../../../com/sleepycat/collections/CurrentTransaction.html" title="class in com.sleepycat.collections">CurrentTransaction</A> <B>getInstance</B>(<A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</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="getEnvironment()"><!-- --></A><H3> getEnvironment</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/Environment.html" title="class in com.sleepycat.db">Environment</A> <B>getEnvironment</B>()</PRE> <DL> <DD>Returns the underlying Berkeley DB environment. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getTransaction()"><!-- --></A><H3> getTransaction</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> <B>getTransaction</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="beginTransaction(com.sleepycat.db.TransactionConfig)"><!-- --></A><H3> beginTransaction</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> <B>beginTransaction</B>(<A HREF="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db">TransactionConfig</A> config) throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</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>config</CODE> - the transaction configuration used for calling <A HREF="../../../com/sleepycat/db/Environment.html#beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)"><CODE>Environment.beginTransaction(com.sleepycat.db.Transaction, com.sleepycat.db.TransactionConfig)</CODE></A>, or null to use the default configuration. <DT><B>Returns:</B><DD>the new transaction. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if the transaction cannot be started, in which case any existing transaction is not affected. <DD><CODE>java.lang.IllegalStateException</CODE> - if a transaction is already active and nested transactions are not supported by the environment.</DL> </DD> </DL> <HR> <A NAME="commitTransaction()"><!-- --></A><H3> commitTransaction</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> <B>commitTransaction</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</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/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</A></CODE> - if an error occurs committing 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 environment.</DL> </DD> </DL> <HR> <A NAME="abortTransaction()"><!-- --></A><H3> abortTransaction</H3> <PRE> public final <A HREF="../../../com/sleepycat/db/Transaction.html" title="class in com.sleepycat.db">Transaction</A> <B>abortTransaction</B>() throws <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</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/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</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 environment.</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/collections/MapEntryParameter.html" title="class in com.sleepycat.collections"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/collections/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>