blob: 9664f35ee865a5f0610d339eeb894c1268b5b3c9 [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>ResultSender (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="ResultSender (Apache Geode 1.15.1)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/geode/cache/execute/ResultSender.html" target="_top">Frames</a></li>
<li><a href="ResultSender.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.execute</div>
<h2 title="Interface ResultSender" class="title">Interface ResultSender&lt;T&gt;</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">ResultSender&lt;T&gt;</span></pre>
<div class="block">Provides methods to send results back to the ResultCollector. A ResultSender adds the ability for
an execute method to send a single result back, or break its result into multiple pieces and send
each piece back to the calling thread's <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><code>ResultCollector</code></a>. For each result sent using this
method, <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</code></a>
is called, making that result available to the calling thread immediately.
<p>
Example:
<pre>
execute(FunctionContext context){
ResultSender rs = context.getResultSender();
int lastResult = -1;
for(int i=0;i&lt; 10; i++) {
rs.sendResult(i);
}
rs.lastResult(lastResult);
}
Application can receive the results as they are sent using ResultSender in the above for loop.
It is very important to send a last result as it informs <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><code>ResultCollector</code></a>
to stop waiting for the result.
<br>
</pre></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</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></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/execute/ResultSender.html#lastResult-T-">lastResult</a></span>(<a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="type parameter in ResultSender">T</a>&nbsp;lastResult)</code>
<div class="block">Sends a result back to the FunctionService calling thread and invokes
<a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</code></a> and
then <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>ResultCollector.endResults()</code></a> if it is the last instance of the Function to report
results.</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/execute/ResultSender.html#sendException-java.lang.Throwable-">sendException</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;t)</code>
<div class="block">Sends an Exception back to the FunctionService calling 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/execute/ResultSender.html#sendResult-T-">sendResult</a></span>(<a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="type parameter in ResultSender">T</a>&nbsp;oneResult)</code>
<div class="block">Sends a result back to the FunctionService calling thread and invokes
<a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</code></a>.</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="sendResult-java.lang.Object-">
<!-- -->
</a><a name="sendResult-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sendResult</h4>
<pre>void&nbsp;sendResult(<a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="type parameter in ResultSender">T</a>&nbsp;oneResult)</pre>
<div class="block">Sends a result back to the FunctionService calling thread and invokes
<a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>oneResult</code> - the result to be sent</dd>
</dl>
</li>
</ul>
<a name="lastResult-java.lang.Object-">
<!-- -->
</a><a name="lastResult-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lastResult</h4>
<pre>void&nbsp;lastResult(<a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="type parameter in ResultSender">T</a>&nbsp;lastResult)</pre>
<div class="block">Sends a result back to the FunctionService calling thread and invokes
<a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>ResultCollector.addResult(org.apache.geode.distributed.DistributedMember, Object)</code></a> and
then <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>ResultCollector.endResults()</code></a> if it is the last instance of the Function to report
results. The ResultCollector will keep waiting for results until it receives last result.
Therefore, it is very important to use this method to indicate end of function execution.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lastResult</code> - the result to be sent</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 called more than once</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>ResultCollector.endResults()</code></a></dd>
</dl>
</li>
</ul>
<a name="sendException-java.lang.Throwable-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>sendException</h4>
<pre>void&nbsp;sendException(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a>&nbsp;t)</pre>
<div class="block">Sends an Exception back to the FunctionService calling thread. sendException adds exception to
ResultCollector as a result. If sendException is called then <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#getResult--"><code>ResultCollector.getResult()</code></a>
will not throw exception but will have exception as a part of results received. Calling
sendException will act as a lastResult.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>t</code> - the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang"><code>Throwable</code></a> to be sent</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>GemFire 6.3</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../org/apache/geode/cache/execute/ResultSender.html#lastResult-T-"><code>lastResult(Object)</code></a></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/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/geode/cache/execute/ResultSender.html" target="_top">Frames</a></li>
<li><a href="ResultSender.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>