<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_75) on Fri May 13 13:32:17 PDT 2016 --> <title>Transaction (Oracle - Berkeley DB Java API)</title> <meta name="date" content="2016-05-13"> <link rel="stylesheet" type="text/css" href="../../../style.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Transaction (Oracle - Berkeley DB Java API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Transaction.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/sleepycat/db/Transaction.html" target="_top">Frames</a></li> <li><a href="Transaction.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.sleepycat.db</div> <h2 title="Class Transaction" class="title">Class Transaction</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.sleepycat.db.Transaction</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public class <span class="strong">Transaction</span> extends java.lang.Object</pre> <div class="block">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 (except to retrieve the commit token), 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,%20com.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></div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#abort()">abort</a></strong>()</code> <div class="block">Cause an abnormal termination of the transaction.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#commit()">commit</a></strong>()</code> <div class="block">End the transaction.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#commitNoSync()">commitNoSync</a></strong>()</code> <div class="block">End the transaction, not committing synchronously.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#commitSync()">commitSync</a></strong>()</code> <div class="block">End the transaction, committing synchronously.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#commitWriteNoSync()">commitWriteNoSync</a></strong>()</code> <div class="block">End the transaction, writing but not flushing the log.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#discard()">discard</a></strong>()</code> <div class="block">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.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>byte[]</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#getCommitToken()">getCommitToken</a></strong>()</code> <div class="block">Fetch the transaction's commit token.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#getId()">getId</a></strong>()</code> <div class="block">Return the transaction's unique ID.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#getName()">getName</a></strong>()</code> <div class="block">Get the user visible name for the transaction.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#getPriority()">getPriority</a></strong>()</code> <div class="block">Get the transaction's deadlock priority.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#prepare(byte[])">prepare</a></strong>(byte[] gid)</code> <div class="block">Initiate the beginning of a two-phase commit.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#setLockTimeout(long)">setLockTimeout</a></strong>(long timeOut)</code> <div class="block">Configure the lock request timeout value for the transaction.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#setName(java.lang.String)">setName</a></strong>(java.lang.String name)</code> <div class="block">Set the user visible name for the transaction.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#setPriority(int)">setPriority</a></strong>(int priority)</code> <div class="block">Set the deadlock priority for this transaction.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/Transaction.html#setTxnTimeout(long)">setTxnTimeout</a></strong>(long timeOut)</code> <div class="block">Configure the timeout value for the transaction lifetime.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getCommitToken()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getCommitToken</h4> <pre>public byte[] getCommitToken() throws java.lang.IllegalStateException</pre> <div class="block">Fetch the transaction's commit token. <p> This operation can only be performed after this transaction has committed.</div> <dl><dt><span class="strong">Returns:</span></dt><dd>The commit token generated at the commit time of this transaction. <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs</dd> <dd><code>java.lang.IllegalStateException</code></dd></dl> </li> </ul> <a name="abort()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>abort</h4> <pre>public void abort() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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. This method closes all open <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles. And if a close operation fails, the rest of the cursors are closed, and the database environment is set to the panic state. <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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="commit()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>commit</h4> <pre>public void commit() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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. If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the transaction is aborted and the first such error is returned. <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 (except to retrieve the commit token), 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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="commitSync()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>commitSync</h4> <pre>public void commitSync() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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,%20com.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. If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the transaction is aborted and the first such error is returned. <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 (except to retrieve the commit token), 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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="commitNoSync()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>commitNoSync</h4> <pre>public void commitNoSync() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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,%20com.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. If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the transaction is aborted and the first such error is returned. <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 (except to retrieve the commit token), 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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="commitWriteNoSync()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>commitWriteNoSync</h4> <pre>public void commitWriteNoSync() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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,%20com.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. If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the transaction is aborted and the first such error is returned. <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 (except to retrieve the commit token), 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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="discard()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>discard</h4> <pre>public void discard() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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,%20boolean)"><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,%20boolean)"><code>Environment.recover</code></a> that are not handled by the current global transaction manager should be discarded using this method. If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the first such error is returned. <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></div> <dl><dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="getId()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getId</h4> <pre>public int getId() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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,%20boolean,%20com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.LockRequestMode)"><code>Environment.getLock</code></a> or <a href="../../../com/sleepycat/db/Environment.html#lockVector(int,%20boolean,%20com.sleepycat.db.LockRequest[])"><code>Environment.lockVector</code></a> calls. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The transaction's unique ID. <p> <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="getName()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getName</h4> <pre>public java.lang.String getName() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">Get the user visible name for the transaction. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The user visible name for the transaction. <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code></dd></dl> </li> </ul> <a name="getPriority()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPriority</h4> <pre>public int getPriority() throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">Get the transaction's deadlock priority. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The deadlock priority for the transaction. <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs</dd></dl> </li> </ul> <a name="prepare(byte[])"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>prepare</h4> <pre>public void prepare(byte[] gid) throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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> If there are <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> handles open when this method is called, they are all closed inside this method. And if there are errors when closing the cursor handles, the first such error is returned. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><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,%20boolean)"><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></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="setName(java.lang.String)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setName</h4> <pre>public void setName(java.lang.String name) throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">Set the user visible name for the transaction. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - The user visible name for the transaction. <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code></dd></dl> </li> </ul> <a name="setPriority(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPriority</h4> <pre>public void setPriority(int priority) throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">Set the deadlock priority for this transaction. The deadlock detector will reject lock requests from lower priority transactions before those from higher priority transactions. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>priority</code> - The deadlock priority for the transaction. <p></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="setTxnTimeout(long)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setTxnTimeout</h4> <pre>public void setTxnTimeout(long timeOut) throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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></div> <dl><dt><span class="strong">Parameters:</span></dt><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></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> <a name="setLockTimeout(long)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>setLockTimeout</h4> <pre>public void setLockTimeout(long timeOut) throws <a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></pre> <div class="block">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></div> <dl><dt><span class="strong">Parameters:</span></dt><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></dd> <dt><span class="strong">Throws:</span></dt> <dd><code><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db">DatabaseException</a></code> - if a failure occurs.</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/Transaction.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/sleepycat/db/StatsConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/sleepycat/db/TransactionConfig.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/sleepycat/db/Transaction.html" target="_top">Frames</a></li> <li><a href="Transaction.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li>Constr | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size=1>Copyright (c) 1996, 2016 Oracle and/or its affiliates. All rights reserved.</font></small></p> </body> </html>