blob: a7b5b07ae0504f58512bc3ce58d9aced0f6d6716 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<META NAME="ROBOTS" CONTENT="NOINDEX">
<link rel="canonical" href="https://ignite.apache.org/releases/1.7.0/javadoc/org/apache/ignite/transactions/Transaction.html" />
<!-- Generated by javadoc (version 1.7.0_80) on Mon Aug 01 20:32:32 MSK 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Transaction (Ignite 1.7.0)</title>
<meta name="date" content="2016-08-01">
<link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-61232409-1', 'auto');
ga('send', 'pageview');
</script></head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Transaction (Ignite 1.7.0)";
}
//-->
</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>Ignite - In-Memory Data Fabric</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html" title="enum in org.apache.ignite.transactions"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/ignite/transactions/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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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">org.apache.ignite.transactions</div>
<h2 title="Interface Transaction" class="title">Interface Transaction</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a>, <a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html" title="interface in org.apache.ignite.lang">IgniteAsyncSupport</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">Transaction</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a>, <a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html" title="interface in org.apache.ignite.lang">IgniteAsyncSupport</a></pre>
<div class="block">Ignite cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and
can be plugged into ongoing <code>JTA</code> transaction by properly implementing
<a href="../../../../org/apache/ignite/cache/jta/CacheTmLookup.html"><code>CacheTmLookup</code></a>
interface. Cache transactions can also be started explicitly directly from <a href="../../../../org/apache/ignite/IgniteTransactions.html" title="interface in org.apache.ignite"><code>IgniteTransactions</code></a> API
via any of the <code>'IgniteTransactions.txStart(..)'</code> methods.
<p>
Cache transactions support the following isolation levels:
<ul>
<li>
<a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#READ_COMMITTED"><code>TransactionIsolation.READ_COMMITTED</code></a> isolation level means that always a committed value
will be provided for read operations. With this isolation level values are always read
from cache global memory or persistent store every time a value is accessed. In other words,
if the same key is accessed more than once within the same transaction, it may have different
value every time since global cache memory may be updated concurrently by other threads.
</li>
<li>
<a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#REPEATABLE_READ"><code>TransactionIsolation.REPEATABLE_READ</code></a> isolation level means that if a value was read once
within transaction, then all consecutive reads will provide the same in-transaction value. With
this isolation level accessed values are stored within in-transaction memory, so consecutive access
to the same key within the same transaction will always return the value that was previously read or
updated within this transaction. If concurrency is <a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html#PESSIMISTIC"><code>TransactionConcurrency.PESSIMISTIC</code></a>, then a lock
on the key will be acquired prior to accessing the value.
</li>
<li>
<a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#SERIALIZABLE"><code>TransactionIsolation.SERIALIZABLE</code></a> isolation level means that all transactions occur in a completely
isolated fashion, as if all transactions in the system had executed serially, one after the other.
Read access with this level happens the same way as with <a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#REPEATABLE_READ"><code>TransactionIsolation.REPEATABLE_READ</code></a> level.
However, in <a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html#OPTIMISTIC"><code>TransactionConcurrency.OPTIMISTIC</code></a> mode, if some transactions cannot be serially isolated
from each other, then one winner will be picked and the other transactions in conflict will result in
<a href="../../../../org/apache/ignite/transactions/TransactionOptimisticException.html" title="class in org.apache.ignite.transactions"><code>TransactionOptimisticException</code></a> being thrown.
</li>
</ul>
<p>
Cache transactions support the following concurrency models:
<ul>
<li>
<a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html#OPTIMISTIC"><code>TransactionConcurrency.OPTIMISTIC</code></a> - in this mode all cache operations are not distributed to other
nodes until <a href="../../../../org/apache/ignite/transactions/Transaction.html#commit()"><code>commit()</code></a> is called. In this mode one <code>'PREPARE'</code>
message will be sent to participating cache nodes to start acquiring per-transaction locks, and once
all nodes reply <code>'OK'</code> (i.e. <code>Phase 1</code> completes successfully), a one-way' <code>'COMMIT'</code>
message is sent without waiting for reply. If it is necessary to know whenever remote nodes have committed
as well, synchronous commit or synchronous rollback should be enabled via
<a href="../../../../org/apache/ignite/configuration/CacheConfiguration.html#setWriteSynchronizationMode(org.apache.ignite.cache.CacheWriteSynchronizationMode)"><code>CacheConfiguration.setWriteSynchronizationMode(org.apache.ignite.cache.CacheWriteSynchronizationMode)</code></a>.
<p>
Note that in this mode, optimistic failures are only possible in conjunction with
<a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#SERIALIZABLE"><code>TransactionIsolation.SERIALIZABLE</code></a> isolation level. In all other cases, optimistic
transactions will never fail optimistically and will always be identically ordered on all participating
grid nodes.
</li>
<li>
<a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html#PESSIMISTIC"><code>TransactionConcurrency.PESSIMISTIC</code></a> - in this mode a lock is acquired on all cache operations
with exception of read operations in <a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html#READ_COMMITTED"><code>TransactionIsolation.READ_COMMITTED</code></a> mode. All optional filters
passed into cache operations will be evaluated after successful lock acquisition. Whenever
<a href="../../../../org/apache/ignite/transactions/Transaction.html#commit()"><code>commit()</code></a> is called, a single one-way <code>'COMMIT'</code> message
is sent to participating cache nodes without waiting for reply. Note that there is no reason for
distributed 'PREPARE' step, as all locks have been already acquired. Just like with optimistic mode,
it is possible to configure synchronous commit or rollback and wait till transaction commits on
all participating remote nodes.
</li>
</ul>
<p>
<h1 class="header">Cache Atomicity Mode</h1>
In addition to standard <a href="../../../../org/apache/ignite/cache/CacheAtomicityMode.html#TRANSACTIONAL"><code>CacheAtomicityMode.TRANSACTIONAL</code></a> behavior, Ignite also supports
a lighter <a href="../../../../org/apache/ignite/cache/CacheAtomicityMode.html#ATOMIC"><code>CacheAtomicityMode.ATOMIC</code></a> mode as well. In this mode distributed transactions
and distributed locking are not supported. Disabling transactions and locking allows to achieve much higher
performance and throughput ratios. It is recommended that <a href="../../../../org/apache/ignite/cache/CacheAtomicityMode.html#ATOMIC"><code>CacheAtomicityMode.ATOMIC</code></a> mode
is used whenever full <code>ACID</code>-compliant transactions are not needed.
<p>
<h1 class="header">Usage</h1>
You can use cache transactions as follows:
<pre name="code" class="java">
Ignite ignite = Ignition.ignite();
IgniteCache&lt;String, Integer&gt; cache = ignite.cache(cacheName);
try (Transaction tx = ignite.transactions().txStart()) {
// Perform transactional operations.
Integer v1 = cache.get("k1");
// Check if v1 satisfies some condition before doing a put.
if (v1 != null && v1 > 0)
cache.put("k1", 2);
cache.remove("k2");
// Commit the transaction.
tx.commit();
}
</pre></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">&nbsp;</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="../../../../org/apache/ignite/transactions/Transaction.html#close()">close</a></strong>()</code>
<div class="block">Ends the transaction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#commit()">commit</a></strong>()</code>
<div class="block">Commits this transaction by initiating <code>two-phase-commit</code> process.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html" title="enum in org.apache.ignite.transactions">TransactionConcurrency</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#concurrency()">concurrency</a></strong>()</code>
<div class="block">Cache transaction concurrency mode.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#implicit()">implicit</a></strong>()</code>
<div class="block">Flag indicating whether transaction was started automatically by the
system or not.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#isInvalidate()">isInvalidate</a></strong>()</code>
<div class="block">Get invalidation flag for this transaction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html" title="enum in org.apache.ignite.transactions">TransactionIsolation</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#isolation()">isolation</a></strong>()</code>
<div class="block">Cache transaction isolation level.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#isRollbackOnly()">isRollbackOnly</a></strong>()</code>
<div class="block">If transaction was marked as rollback-only.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html?is-external=true" title="class or interface in java.util">UUID</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#nodeId()">nodeId</a></strong>()</code>
<div class="block">ID of the node on which this transaction started.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#rollback()">rollback</a></strong>()</code>
<div class="block">Rolls back this transaction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#setRollbackOnly()">setRollbackOnly</a></strong>()</code>
<div class="block">Modify the transaction associated with the current thread such that the
only possible outcome of the transaction is to roll back the
transaction.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#startTime()">startTime</a></strong>()</code>
<div class="block">Start time of this transaction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/ignite/transactions/TransactionState.html" title="enum in org.apache.ignite.transactions">TransactionState</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#state()">state</a></strong>()</code>
<div class="block">Gets current transaction state value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#threadId()">threadId</a></strong>()</code>
<div class="block">ID of the thread in which this transaction started.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#timeout()">timeout</a></strong>()</code>
<div class="block">Gets timeout value in milliseconds for this transaction.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#timeout(long)">timeout</a></strong>(long&nbsp;timeout)</code>
<div class="block">Sets transaction timeout value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/ignite/lang/IgniteUuid.html" title="class in org.apache.ignite.lang">IgniteUuid</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/ignite/transactions/Transaction.html#xid()">xid</a></strong>()</code>
<div class="block">Gets unique identifier for this transaction.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.apache.ignite.lang.IgniteAsyncSupport">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;org.apache.ignite.lang.<a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html" title="interface in org.apache.ignite.lang">IgniteAsyncSupport</a></h3>
<code><a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html#future()">future</a>, <a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html#isAsync()">isAsync</a>, <a href="../../../../org/apache/ignite/lang/IgniteAsyncSupport.html#withAsync()">withAsync</a></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="xid()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>xid</h4>
<pre><a href="../../../../org/apache/ignite/lang/IgniteUuid.html" title="class in org.apache.ignite.lang">IgniteUuid</a>&nbsp;xid()</pre>
<div class="block">Gets unique identifier for this transaction.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Transaction UID.</dd></dl>
</li>
</ul>
<a name="nodeId()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nodeId</h4>
<pre><a href="http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html?is-external=true" title="class or interface in java.util">UUID</a>&nbsp;nodeId()</pre>
<div class="block">ID of the node on which this transaction started.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Originating node ID.</dd></dl>
</li>
</ul>
<a name="threadId()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>threadId</h4>
<pre>long&nbsp;threadId()</pre>
<div class="block">ID of the thread in which this transaction started.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Thread ID.</dd></dl>
</li>
</ul>
<a name="startTime()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>startTime</h4>
<pre>long&nbsp;startTime()</pre>
<div class="block">Start time of this transaction.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Start time of this transaction on this node.</dd></dl>
</li>
</ul>
<a name="isolation()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isolation</h4>
<pre><a href="../../../../org/apache/ignite/transactions/TransactionIsolation.html" title="enum in org.apache.ignite.transactions">TransactionIsolation</a>&nbsp;isolation()</pre>
<div class="block">Cache transaction isolation level.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Isolation level.</dd></dl>
</li>
</ul>
<a name="concurrency()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>concurrency</h4>
<pre><a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html" title="enum in org.apache.ignite.transactions">TransactionConcurrency</a>&nbsp;concurrency()</pre>
<div class="block">Cache transaction concurrency mode.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Concurrency mode.</dd></dl>
</li>
</ul>
<a name="implicit()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>implicit</h4>
<pre>boolean&nbsp;implicit()</pre>
<div class="block">Flag indicating whether transaction was started automatically by the
system or not. System will start transactions implicitly whenever
any cache <code>put(..)</code> or <code>remove(..)</code> operation is invoked
outside of transaction.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd><code>True</code> if transaction was started implicitly.</dd></dl>
</li>
</ul>
<a name="isInvalidate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isInvalidate</h4>
<pre>boolean&nbsp;isInvalidate()</pre>
<div class="block">Get invalidation flag for this transaction. If set to <code>true</code>, then
remote values will be <code>invalidated</code> (set to <code>null</code>) instead
of updated.
<p>
Invalidation messages don't carry new values, so they are a lot lighter
than update messages. However, when a value is accessed on a node after
it's been invalidated, it must be loaded from persistent store.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Invalidation flag.</dd></dl>
</li>
</ul>
<a name="state()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>state</h4>
<pre><a href="../../../../org/apache/ignite/transactions/TransactionState.html" title="enum in org.apache.ignite.transactions">TransactionState</a>&nbsp;state()</pre>
<div class="block">Gets current transaction state value.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Current transaction state.</dd></dl>
</li>
</ul>
<a name="timeout()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>timeout</h4>
<pre>long&nbsp;timeout()</pre>
<div class="block">Gets timeout value in milliseconds for this transaction. If transaction times
out prior to it's completion, <a href="../../../../org/apache/ignite/transactions/TransactionTimeoutException.html" title="class in org.apache.ignite.transactions"><code>TransactionTimeoutException</code></a> will be thrown.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Transaction timeout value.</dd></dl>
</li>
</ul>
<a name="timeout(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>timeout</h4>
<pre>long&nbsp;timeout(long&nbsp;timeout)</pre>
<div class="block">Sets transaction timeout value. This value can be set only before a first operation
on transaction has been performed.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>timeout</code> - Transaction timeout value.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Previous timeout.</dd></dl>
</li>
</ul>
<a name="setRollbackOnly()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRollbackOnly</h4>
<pre>boolean&nbsp;setRollbackOnly()</pre>
<div class="block">Modify the transaction associated with the current thread such that the
only possible outcome of the transaction is to roll back the
transaction.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd><code>True</code> if rollback-only flag was set as a result of this operation,
<code>false</code> if it was already set prior to this call or could not be set
because transaction is already finishing up committing or rolling back.</dd></dl>
</li>
</ul>
<a name="isRollbackOnly()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isRollbackOnly</h4>
<pre>boolean&nbsp;isRollbackOnly()</pre>
<div class="block">If transaction was marked as rollback-only.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd><code>True</code> if transaction can only be rolled back.</dd></dl>
</li>
</ul>
<a name="commit()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>commit</h4>
<pre><a href="../../../../org/apache/ignite/lang/IgniteAsyncSupported.html" title="annotation in org.apache.ignite.lang">@IgniteAsyncSupported</a>
void&nbsp;commit()
throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre>
<div class="block">Commits this transaction by initiating <code>two-phase-commit</code> process.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - If commit failed.</dd>
<dd><code><a href="../../../../org/apache/ignite/transactions/TransactionTimeoutException.html" title="class in org.apache.ignite.transactions">TransactionTimeoutException</a></code> - If transaction is timed out.</dd>
<dd><code><a href="../../../../org/apache/ignite/transactions/TransactionRollbackException.html" title="class in org.apache.ignite.transactions">TransactionRollbackException</a></code> - If transaction is automatically rolled back.</dd>
<dd><code><a href="../../../../org/apache/ignite/transactions/TransactionOptimisticException.html" title="class in org.apache.ignite.transactions">TransactionOptimisticException</a></code> - If transaction concurrency is <a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html#OPTIMISTIC"><code>TransactionConcurrency.OPTIMISTIC</code></a>
and commit is optimistically failed.</dd>
<dd><code><a href="../../../../org/apache/ignite/transactions/TransactionHeuristicException.html" title="class in org.apache.ignite.transactions">TransactionHeuristicException</a></code> - If transaction has entered an unknown state.</dd></dl>
</li>
</ul>
<a name="close()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>void&nbsp;close()
throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre>
<div class="block">Ends the transaction. Transaction will be rolled back if it has not been committed.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true#close()" title="class or interface in java.lang">close</a></code>&nbsp;in interface&nbsp;<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a></code></dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - If transaction could not be gracefully ended.</dd></dl>
</li>
</ul>
<a name="rollback()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>rollback</h4>
<pre><a href="../../../../org/apache/ignite/lang/IgniteAsyncSupported.html" title="annotation in org.apache.ignite.lang">@IgniteAsyncSupported</a>
void&nbsp;rollback()
throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre>
<div class="block">Rolls back this transaction.</div>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></code> - If rollback failed.</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>Ignite - In-Memory Data Fabric</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../org/apache/ignite/transactions/TransactionConcurrency.html" title="enum in org.apache.ignite.transactions"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/ignite/transactions/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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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><table width="100%" border="0" cellspacing=0 cellpadding=0 style="padding: 5px"> <tr> <td> <table style="padding-left: 0; margin: 0"> <tbody style="padding: 0; margin: 0"> <tr style="padding: 0; margin: 0"> <td> <a target=_blank href="https://ignite.apache.org"><nobr>2015 Copyright &#169; Apache Software Foundation</nobr></a> </td> </tr> </tbody> </table> </td> <td width="100%" align="right" valign="center"> <a href="https://twitter.com/ApacheIgnite" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @ApacheIgnite</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> </td> </tr> <tr> <td colspan="2" valign="top" align="left"> <table style="padding-left: 0; margin: 0"> <tbody style="padding: 0; margin: 0"> <tr style="padding: 0; margin: 0"> <td> <b>Ignite Fabric</b> </td> <td>:&nbsp;&nbsp; ver. <strong>1.7.0</strong> </td> </tr> <tr style="padding: 0; margin: 0"> <td> <b>Release Date</b> </td> <td>:&nbsp;&nbsp; August 1 2016 </td> </tr> </tbody> </table> </td> </tr> </table></small></p>
</body>
</html>