| <!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>ResultCollector (Apache Geode 1.15.0)</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="ResultCollector (Apache Geode 1.15.0)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":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/RegionFunctionContext.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/geode/cache/execute/ResultCollector.html" target="_top">Frames</a></li> |
| <li><a href="ResultCollector.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">org.apache.geode.cache.execute</div> |
| <h2 title="Interface ResultCollector" class="title">Interface ResultCollector<T,S></h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">ResultCollector<T,S></span></pre> |
| <div class="block"><p> |
| Defines the interface for a container that gathers results from function execution.<br> |
| GemFire provides a default implementation for ResultCollector. Applications can choose to |
| implement their own custom ResultCollector. A custom ResultCollector facilitates result sorting |
| or aggregation. Aggregation functions like sum, minimum, maximum and average can also be applied |
| to the result using a custom ResultCollector. Results arrive as they are sent using the |
| <a href="../../../../../org/apache/geode/cache/execute/ResultSender.html#sendResult-T-"><code>ResultSender.sendResult(Object)</code></a> and can be used as they arrive. To indicate that all |
| results have been received <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>endResults()</code></a> is called. |
| |
| <p> |
| Example: <br> |
| |
| <pre> |
| Region region ; |
| Set keySet = Collections.singleton("myKey"); |
| Function multiGetFunction ; |
| Object args ; |
| ResultCollector rc = FunctionService.onRegion(region) |
| .setArguments(args) |
| .withFilter(keySet) |
| .withCollector(new MyCustomResultCollector()) |
| .execute(multiGetFunction.getId()); |
| Application can do something else here before retrieving the result |
| Or it can have some logic in {<a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>addResult(DistributedMember, Object)</code></a> to use the partial results. |
| If it wants to see all the results it can use |
| Object functionResult = rc.getResult(); |
| or |
| Object functionResult = rc.getResult(timeout,TimeUnit); |
| depending on if it wants to wait for all the results or wait for a timeout period. |
| </pre> |
| |
| GemFire provides default implementation of ResultCollector which collects results in Arraylist. |
| There is no need to provide a synchronization mechanism in the user implementations of |
| ResultCollector</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>GemFire 6.0</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"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </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/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-">addResult</a></span>(<a href="../../../../../org/apache/geode/distributed/DistributedMember.html" title="interface in org.apache.geode.distributed">DistributedMember</a> memberID, |
| <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">T</a> resultOfSingleExecution)</code> |
| <div class="block">Method used to feed result to the ResultCollector.</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/ResultCollector.html#clearResults--">clearResults</a></span>()</code> |
| <div class="block">GemFire will invoke this method before re-executing function (in case of Function Execution |
| HA).</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/ResultCollector.html#endResults--">endResults</a></span>()</code> |
| <div class="block">GemFire will invoke this method when function execution has completed and all results for the |
| execution have been obtained and <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>added to the |
| ResultCollector</code></a> Unless the <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><code>ResultCollector</code></a> has received |
| <a href="../../../../../org/apache/geode/cache/execute/ResultSender.html#lastResult-T-"><code>last result</code></a> from all the executing nodes, it keeps |
| waiting for more results to come.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">S</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#getResult--">getResult</a></span>()</code> |
| <div class="block">Method used to pull results from the ResultCollector.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">S</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#getResult-long-java.util.concurrent.TimeUnit-">getResult</a></span>(long timeout, |
| <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> unit)</code> |
| <div class="block">Method used to pull results from the ResultCollector.</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="getResult--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResult</h4> |
| <pre><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">S</a> getResult() |
| throws <a href="../../../../../org/apache/geode/cache/execute/FunctionException.html" title="class in org.apache.geode.cache.execute">FunctionException</a></pre> |
| <div class="block">Method used to pull results from the ResultCollector. It returns the result of function |
| execution, potentially blocking until <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>all the results are available</code></a> has |
| been called.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the result</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../org/apache/geode/cache/execute/FunctionException.html" title="class in org.apache.geode.cache.execute">FunctionException</a></code> - if result retrieval fails</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>GemFire 6.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getResult-long-java.util.concurrent.TimeUnit-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResult</h4> |
| <pre><a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">S</a> getResult(long timeout, |
| <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> unit) |
| throws <a href="../../../../../org/apache/geode/cache/execute/FunctionException.html" title="class in org.apache.geode.cache.execute">FunctionException</a>, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></pre> |
| <div class="block">Method used to pull results from the ResultCollector. It returns the result of function |
| execution, blocking for the timeout period until <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#endResults--"><code>all the results are |
| available</code></a>. If all the results are not received in provided time a FunctionException is thrown.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>timeout</code> - the maximum time to wait</dd> |
| <dd><code>unit</code> - the time unit of the timeout argument</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the result</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../../org/apache/geode/cache/execute/FunctionException.html" title="class in org.apache.geode.cache.execute">FunctionException</a></code> - if result retrieval fails within timeout provided</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</a></code> - if the current thread was interrupted while waiting</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>GemFire 6.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="addResult-org.apache.geode.distributed.DistributedMember-java.lang.Object-"> |
| <!-- --> |
| </a><a name="addResult-org.apache.geode.distributed.DistributedMember-T-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addResult</h4> |
| <pre>void addResult(<a href="../../../../../org/apache/geode/distributed/DistributedMember.html" title="interface in org.apache.geode.distributed">DistributedMember</a> memberID, |
| <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="type parameter in ResultCollector">T</a> resultOfSingleExecution)</pre> |
| <div class="block">Method used to feed result to the ResultCollector. It adds a single function execution result |
| to the ResultCollector It is invoked every time a result is sent using ResultSender.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>memberID</code> - DistributedMember ID to which result belongs</dd> |
| <dd><code>resultOfSingleExecution</code> - the result to add</dd> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>GemFire 6.0</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="endResults--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>endResults</h4> |
| <pre>void endResults()</pre> |
| <div class="block">GemFire will invoke this method when function execution has completed and all results for the |
| execution have been obtained and <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html#addResult-org.apache.geode.distributed.DistributedMember-T-"><code>added to the |
| ResultCollector</code></a> Unless the <a href="../../../../../org/apache/geode/cache/execute/ResultCollector.html" title="interface in org.apache.geode.cache.execute"><code>ResultCollector</code></a> has received |
| <a href="../../../../../org/apache/geode/cache/execute/ResultSender.html#lastResult-T-"><code>last result</code></a> from all the executing nodes, it keeps |
| waiting for more results to come.</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/ResultSender.html#lastResult-T-"><code>ResultSender.lastResult(Object)</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="clearResults--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>clearResults</h4> |
| <pre>void clearResults()</pre> |
| <div class="block">GemFire will invoke this method before re-executing function (in case of Function Execution |
| HA). This is to clear the previous execution results from the result collector</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>GemFire 6.5</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/RegionFunctionContext.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/geode/cache/execute/ResultSender.html" title="interface in org.apache.geode.cache.execute"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/geode/cache/execute/ResultCollector.html" target="_top">Frames</a></li> |
| <li><a href="ResultCollector.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 ======= --> |
| </body> |
| </html> |