blob: 37b3a412253983bbc65681f987df24317f56f361 [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>
<!-- Generated by javadoc -->
<title>CacheTransactionManager (Apache Geode 1.15.1)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CacheTransactionManager (Apache Geode 1.15.1)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":38,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":38,"i17":6,"i18":6,"i19":6,"i20":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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="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>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/geode/cache/CacheStatistics.html" title="interface in org.apache.geode.cache"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/geode/cache/CacheWriter.html" title="interface in org.apache.geode.cache"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/geode/cache/CacheTransactionManager.html" target="_top">Frames</a></li>
<li><a href="CacheTransactionManager.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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.geode.cache</div>
<h2 title="Interface CacheTransactionManager" class="title">Interface CacheTransactionManager</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">CacheTransactionManager</span></pre>
<div class="block"><p>
The CacheTransactionManager interface allows applications to manage transactions on a per
<a href="../../../../org/apache/geode/cache/Cache.html" title="interface in org.apache.geode.cache"><code>Cache</code></a> basis.
<p>
The life cycle of a GemFire transaction starts with a begin operation. The life cycle ends with
either a commit or rollback operation. Between the begin and the commit/rollback are typically
<a href="../../../../org/apache/geode/cache/Region.html" title="interface in org.apache.geode.cache"><code>Region</code></a> operations. In general, those that either create, destroy, invalidate or update
<a href="../../../../org/apache/geode/cache/Region.Entry.html" title="interface in org.apache.geode.cache"><code>Region.Entry</code></a> are considered transactional, that is they modify transactional state.
<p>
A GemFire transaction may involve operations on multiple regions, each of which may have
different attributes.
<p>
While a GemFire transaction and its operations are invoked in the local VM, the resulting
transaction state is distributed to other VM's at commit time as per the attributes of each
participant Region.
<p>
A transaction can have no more than one thread associated with it and conversely a thread can
only operate on one transaction at any given time. Child threads will not inherit the existing
transaction.
<p>
Each of the following methods operate on the current thread. All methods throw
<a href="../../../../org/apache/geode/cache/CacheClosedException.html" title="class in org.apache.geode.cache"><code>CacheClosedException</code></a> if the Cache is closed.
<p>
GemFire Transactions currently only support Read Committed isolation. In addition, they are
optimistic transactions in that write locking and conflict checks are performed as part of the
commit operation.
<p>
For guaranteed Read Committed isolation, avoid making "in place" changes, because such changes
will be "seen" by other transactions and break the Read Committed isolation guarantee. e.g.
<pre>
CacheTransactionManager txMgr = cache.getCacheTransactionManager();
txMgr.begin();
StringBuilder s = (StringBuilder) r.get("stringBuf");
s.append("Changes seen before commit. NOT Read Committed!");
r.put("stringBuf", s);
txMgr.commit();
</pre>
<p>
To aid in creating copies, the "copy on read" <code>Cache</code> attribute and the
<a href="../../../../org/apache/geode/CopyHelper.html#copy-T-"><code>CopyHelper.copy(T)</code></a> method are provided. The following is a Read Committed
safe example using the <code>CopyHelper.copy</code> method.
<pre>
CacheTransactionManager txMgr = cache.getCacheTransactionManager();
txMgr.begin();
Object o = r.get("stringBuf");
StringBuilder s = (StringBuilder) CopyHelper.copy(o);
s.append("Changes unseen before commit. Read Committed.");
r.put("stringBuf", s);
txMgr.commit();
</pre>
<p>
Its important to note that creating copies can negatively impact both performance and memory
consumption.
<p>
Partitioned Regions, Distributed No Ack and Distributed Ack Regions are supported (see
<a href="../../../../org/apache/geode/cache/AttributesFactory.html" title="class in org.apache.geode.cache"><code>AttributesFactory</code></a> for Scope). For both scopes, a consistent configuration (per VM) is
enforced.
<p>
Global Regions, client Regions (see org.apache.geode.cache.client package) and persistent Regions
(see <a href="../../../../org/apache/geode/cache/DiskWriteAttributes.html" title="interface in org.apache.geode.cache"><code>DiskWriteAttributes</code></a>) do not support transactions.
<p>
When PartitionedRegions are involved in a transaction, all data in the transaction must be
colocated together on one data node. See the GemFire Developer Guide for details on using
transactions with Partitioned Regions.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 4.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/Cache.html" title="interface in org.apache.geode.cache"><code>Cache</code></a></dd>
</dl>
</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="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#addListener-org.apache.geode.cache.TransactionListener-">addListener</a></span>(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;aListener)</code>
<div class="block">Adds a transaction listener to the end of the list of transaction listeners on this cache.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#begin--">begin</a></span>()</code>
<div class="block">Creates a new transaction and associates it with the current thread.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#commit--">commit</a></span>()</code>
<div class="block">Commit the transaction associated with the current thread.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#exists--">exists</a></span>()</code>
<div class="block">Reports the existence of a Transaction for this thread</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#exists-org.apache.geode.cache.TransactionId-">exists</a></span>(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</code>
<div class="block">Reports the existence of a transaction for the given transactionId.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getListener--">getListener</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">as of GemFire 5.0, use <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getListeners--"><code>getListeners()</code></a> instead</span></div>
</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getListeners--">getListeners</a></span>()</code>
<div class="block">Returns an array of all the transaction listeners on this cache.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getTransactionId--">getTransactionId</a></span>()</code>
<div class="block">Returns the transaction identifier for the current thread</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache">TransactionWriter</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getWriter--">getWriter</a></span>()</code>
<div class="block">Returns the current <a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache"><code>TransactionWriter</code></a></div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#initListeners-org.apache.geode.cache.TransactionListener:A-">initListeners</a></span>(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>[]&nbsp;newListeners)</code>
<div class="block">Removes all transaction listeners, calling <a href="../../../../org/apache/geode/cache/CacheCallback.html#close--"><code>CacheCallback.close()</code></a> on each of them, and
then adds each listener in the specified array.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#isDistributed--">isDistributed</a></span>()</code>
<div class="block">Returns the execution mode of transactions</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#isSuspended-org.apache.geode.cache.TransactionId-">isSuspended</a></span>(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</code>
<div class="block">This method can be used to determine if a transaction with the given transaction identifier is
currently suspended locally.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#removeListener-org.apache.geode.cache.TransactionListener-">removeListener</a></span>(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;aListener)</code>
<div class="block">Removes a transaction listener from the list of transaction listeners on this cache.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#resume-org.apache.geode.cache.TransactionId-">resume</a></span>(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</code>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a></div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#rollback--">rollback</a></span>()</code>
<div class="block">Roll back the transaction associated with the current thread.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#setDistributed-boolean-">setDistributed</a></span>(boolean&nbsp;distributed)</code>
<div class="block">Sets whether transactions should be executed in distributed or non-distributed mode.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#setListener-org.apache.geode.cache.TransactionListener-">setListener</a></span>(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;newListener)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">as of GemFire 5.0, use <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#addListener-org.apache.geode.cache.TransactionListener-"><code>addListener(org.apache.geode.cache.TransactionListener)</code></a> or <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#initListeners-org.apache.geode.cache.TransactionListener:A-"><code>initListeners(org.apache.geode.cache.TransactionListener[])</code></a> instead.</span></div>
</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#setWriter-org.apache.geode.cache.TransactionWriter-">setWriter</a></span>(<a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache">TransactionWriter</a>&nbsp;writer)</code>
<div class="block">Set the TransactionWriter for the cache</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--">suspend</a></span>()</code>
<div class="block">Suspends the transaction on the current thread.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#tryResume-org.apache.geode.cache.TransactionId-">tryResume</a></span>(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</code>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a>.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#tryResume-org.apache.geode.cache.TransactionId-long-java.util.concurrent.TimeUnit-">tryResume</a></span>(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId,
long&nbsp;time,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a>&nbsp;unit)</code>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a>, or waits for the specified timeout interval if the transaction has not been
suspended.</div>
</td>
</tr>
</table>
</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="begin--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>begin</h4>
<pre>void&nbsp;begin()</pre>
<div class="block">Creates a new transaction and associates it with the current thread.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the thread is already associated with a transaction</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 4.0</dd>
</dl>
</li>
</ul>
<a name="commit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>commit</h4>
<pre>void&nbsp;commit()
throws <a href="../../../../org/apache/geode/cache/CommitConflictException.html" title="class in org.apache.geode.cache">CommitConflictException</a></pre>
<div class="block">Commit the transaction associated with the current thread. If the commit operation fails due to
a conflict it will destroy the transaction state and throw a <a href="../../../../org/apache/geode/cache/CommitConflictException.html" title="class in org.apache.geode.cache"><code>CommitConflictException</code></a>.
If the commit operation succeeds, it returns after the transaction state has been merged with
committed state. When this method completes, the thread is no longer associated with a
transaction.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the thread is not associated with a transaction</dd>
<dd><code><a href="../../../../org/apache/geode/cache/CommitConflictException.html" title="class in org.apache.geode.cache">CommitConflictException</a></code> - if the commit operation fails due to a write conflict.</dd>
<dd><code><a href="../../../../org/apache/geode/cache/TransactionDataNodeHasDepartedException.html" title="class in org.apache.geode.cache">TransactionDataNodeHasDepartedException</a></code> - if the node hosting the transaction data has
departed. This is only relevant for transaction that involve PartitionedRegions.</dd>
<dd><code><a href="../../../../org/apache/geode/cache/TransactionDataNotColocatedException.html" title="class in org.apache.geode.cache">TransactionDataNotColocatedException</a></code> - if at commit time, the data involved in the
transaction has moved away from the transaction hosting node. This can only happen if
rebalancing/recovery happens during a transaction that involves a PartitionedRegion.</dd>
<dd><code><a href="../../../../org/apache/geode/cache/TransactionInDoubtException.html" title="class in org.apache.geode.cache">TransactionInDoubtException</a></code> - when GemFire cannot tell which nodes have applied the
transaction and which have not. This only occurs if nodes fail mid-commit, and only
then in very rare circumstances.</dd>
</dl>
</li>
</ul>
<a name="rollback--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rollback</h4>
<pre>void&nbsp;rollback()</pre>
<div class="block">Roll back the transaction associated with the current thread. When this method completes, the
thread is no longer associated with a transaction and the transaction context is destroyed.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the thread is not associated with a transaction</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 4.0</dd>
</dl>
</li>
</ul>
<a name="suspend--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>suspend</h4>
<pre><a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;suspend()</pre>
<div class="block">Suspends the transaction on the current thread. All subsequent operations performed by this
thread will be non-transactional. The suspended transaction can be resumed by calling
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#resume-org.apache.geode.cache.TransactionId-"><code>resume(TransactionId)</code></a></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the transaction identifier of the suspended transaction or null if the thread was not
associated with a transaction</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
</dl>
</li>
</ul>
<a name="resume-org.apache.geode.cache.TransactionId-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resume</h4>
<pre>void&nbsp;resume(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</pre>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transactionId</code> - the transaction to resume</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if the thread is associated with a transaction or if
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#isSuspended-org.apache.geode.cache.TransactionId-"><code>isSuspended(TransactionId)</code></a> would return false for the given transactionId</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#tryResume-org.apache.geode.cache.TransactionId-"><code>tryResume(TransactionId)</code></a></dd>
</dl>
</li>
</ul>
<a name="isSuspended-org.apache.geode.cache.TransactionId-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSuspended</h4>
<pre>boolean&nbsp;isSuspended(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</pre>
<div class="block">This method can be used to determine if a transaction with the given transaction identifier is
currently suspended locally. This method does not check other members for transaction status.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transactionId</code> - a transaction identifier</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the transaction is in suspended state, false otherwise</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#exists-org.apache.geode.cache.TransactionId-"><code>exists(TransactionId)</code></a></dd>
</dl>
</li>
</ul>
<a name="tryResume-org.apache.geode.cache.TransactionId-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>tryResume</h4>
<pre>boolean&nbsp;tryResume(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</pre>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a>.
This method is equivalent to
<pre>
if (isSuspended(txId)) {
resume(txId);
}
</pre>
except that this action is performed atomically</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transactionId</code> - the transaction to resume</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the transaction was resumed, false otherwise</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
</dl>
</li>
</ul>
<a name="tryResume-org.apache.geode.cache.TransactionId-long-java.util.concurrent.TimeUnit-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>tryResume</h4>
<pre>boolean&nbsp;tryResume(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId,
long&nbsp;time,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a>&nbsp;unit)</pre>
<div class="block">On the current thread, resumes a transaction that was previously suspended using
<a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#suspend--"><code>suspend()</code></a>, or waits for the specified timeout interval if the transaction has not been
suspended. This method will return if:
<ul>
<li>Another thread suspends the transaction</li>
<li>Another thread calls commit/rollback on the transaction</li>
<li>This thread has waited for the specified timeout</li>
</ul>
This method returns immediately if <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#exists-org.apache.geode.cache.TransactionId-"><code>exists(TransactionId)</code></a> returns false.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transactionId</code> - the transaction to resume</dd>
<dd><code>time</code> - the maximum time to wait</dd>
<dd><code>unit</code> - the time unit of the <code>time</code> argument</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the transaction was resumed, false otherwise</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#tryResume-org.apache.geode.cache.TransactionId-"><code>tryResume(TransactionId)</code></a></dd>
</dl>
</li>
</ul>
<a name="exists-org.apache.geode.cache.TransactionId-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>exists</h4>
<pre>boolean&nbsp;exists(<a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;transactionId)</pre>
<div class="block">Reports the existence of a transaction for the given transactionId. This method can be used to
determine if a transaction with the given transaction identifier is currently in progress
locally.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transactionId</code> - the given transaction identifier</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if the transaction is in progress, false otherwise.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.6.2</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#isSuspended-org.apache.geode.cache.TransactionId-"><code>isSuspended(TransactionId)</code></a></dd>
</dl>
</li>
</ul>
<a name="exists--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>exists</h4>
<pre>boolean&nbsp;exists()</pre>
<div class="block">Reports the existence of a Transaction for this thread</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if a transaction exists, false otherwise</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 4.0</dd>
</dl>
</li>
</ul>
<a name="getTransactionId--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransactionId</h4>
<pre><a href="../../../../org/apache/geode/cache/TransactionId.html" title="interface in org.apache.geode.cache">TransactionId</a>&nbsp;getTransactionId()</pre>
<div class="block">Returns the transaction identifier for the current thread</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the transaction identifier or null if no transaction exists</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 4.0</dd>
</dl>
</li>
</ul>
<a name="getListener--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getListener</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;getListener()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">as of GemFire 5.0, use <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#getListeners--"><code>getListeners()</code></a> instead</span></div>
<div class="block">Gets the transaction listener for this Cache.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The TransactionListener instance or null if no listener.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if more than one listener exists on this cache</dd>
</dl>
</li>
</ul>
<a name="getListeners--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getListeners</h4>
<pre><a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>[]&nbsp;getListeners()</pre>
<div class="block">Returns an array of all the transaction listeners on this cache. Modifications to the returned
array will not effect what listeners are on this cache.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the cache's <code>TransactionListener</code>s; an empty array if no listeners</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 5.0</dd>
</dl>
</li>
</ul>
<a name="setListener-org.apache.geode.cache.TransactionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setListener</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;setListener(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;newListener)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">as of GemFire 5.0, use <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#addListener-org.apache.geode.cache.TransactionListener-"><code>addListener(org.apache.geode.cache.TransactionListener)</code></a> or <a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#initListeners-org.apache.geode.cache.TransactionListener:A-"><code>initListeners(org.apache.geode.cache.TransactionListener[])</code></a> instead.</span></div>
<div class="block">Sets the transaction listener for this Cache.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>newListener</code> - the TransactionListener to register with the Cache. Use a <code>null</code>
to deregister the current listener without registering a new one.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the previous TransactionListener</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if more than one listener exists on this cache</dd>
</dl>
</li>
</ul>
<a name="addListener-org.apache.geode.cache.TransactionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addListener</h4>
<pre>void&nbsp;addListener(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;aListener)</pre>
<div class="block">Adds a transaction listener to the end of the list of transaction listeners on this cache.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>aListener</code> - the user defined transaction listener to add to the cache.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>aListener</code> is null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 5.0</dd>
</dl>
</li>
</ul>
<a name="removeListener-org.apache.geode.cache.TransactionListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeListener</h4>
<pre>void&nbsp;removeListener(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>&nbsp;aListener)</pre>
<div class="block">Removes a transaction listener from the list of transaction listeners on this cache. Does
nothing if the specified listener has not been added. If the specified listener has been added
then <a href="../../../../org/apache/geode/cache/CacheCallback.html#close--"><code>CacheCallback.close()</code></a> will be called on it; otherwise does nothing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>aListener</code> - the transaction listener to remove from the cache.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>aListener</code> is null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 5.0</dd>
</dl>
</li>
</ul>
<a name="initListeners-org.apache.geode.cache.TransactionListener:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initListeners</h4>
<pre>void&nbsp;initListeners(<a href="../../../../org/apache/geode/cache/TransactionListener.html" title="interface in org.apache.geode.cache">TransactionListener</a>[]&nbsp;newListeners)</pre>
<div class="block">Removes all transaction listeners, calling <a href="../../../../org/apache/geode/cache/CacheCallback.html#close--"><code>CacheCallback.close()</code></a> on each of them, and
then adds each listener in the specified array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>newListeners</code> - a possibly null or empty array of listeners to add to this cache.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the <code>newListeners</code> array has a null element</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 5.0</dd>
</dl>
</li>
</ul>
<a name="setWriter-org.apache.geode.cache.TransactionWriter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setWriter</h4>
<pre>void&nbsp;setWriter(<a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache">TransactionWriter</a>&nbsp;writer)</pre>
<div class="block">Set the TransactionWriter for the cache</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>writer</code> - the TransactionWriter for the cache</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.5</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache"><code>TransactionWriter</code></a></dd>
</dl>
</li>
</ul>
<a name="getWriter--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getWriter</h4>
<pre><a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache">TransactionWriter</a>&nbsp;getWriter()</pre>
<div class="block">Returns the current <a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache"><code>TransactionWriter</code></a></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the current <a href="../../../../org/apache/geode/cache/TransactionWriter.html" title="interface in org.apache.geode.cache"><code>TransactionWriter</code></a></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.5</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/apache/geode/cache/CacheTransactionManager.html#setWriter-org.apache.geode.cache.TransactionWriter-"><code>setWriter(TransactionWriter)</code></a></dd>
</dl>
</li>
</ul>
<a name="setDistributed-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDistributed</h4>
<pre>void&nbsp;setDistributed(boolean&nbsp;distributed)</pre>
<div class="block">Sets whether transactions should be executed in distributed or non-distributed mode. Once set
this mode should not be changed during the course of transactions.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>distributed</code> - whether transactions should be executed in distributed or non-distributed
mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</a></code> - if a transaction is already in progress and this method sets the
distributed mode to a different value.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Geode 1.0</dd>
</dl>
</li>
</ul>
<a name="isDistributed--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isDistributed</h4>
<pre>boolean&nbsp;isDistributed()</pre>
<div class="block">Returns the execution mode of transactions</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if distributed, false otherwise.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Geode 1.0</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>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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="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>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/geode/cache/CacheStatistics.html" title="interface in org.apache.geode.cache"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/geode/cache/CacheWriter.html" title="interface in org.apache.geode.cache"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/geode/cache/CacheTransactionManager.html" target="_top">Frames</a></li>
<li><a href="CacheTransactionManager.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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 ======= -->
</body>
</html>