| <!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.6.0/javadoc/org/apache/ignite/compute/ComputeTask.html" /> |
| <!-- Generated by javadoc (version 1.7.0_80) on Wed May 18 17:03:58 MSK 2016 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>ComputeTask (Ignite 1.6.0)</title> |
| <meta name="date" content="2016-05-18"> |
| <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="ComputeTask (Ignite 1.6.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/ComputeTask.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><a href="../../../../org/apache/ignite/compute/ComputeLoadBalancer.html" title="interface in org.apache.ignite.compute"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/ignite/compute/ComputeTask.html" target="_top">Frames</a></li> |
| <li><a href="ComputeTask.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.ignite.compute</div> |
| <h2 title="Interface ComputeTask" class="title">Interface ComputeTask<T,R></h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>T</code> - Type of the task argument that is passed into <a href="../../../../org/apache/ignite/compute/ComputeTask.html#map(java.util.List,%20T)"><code>map(List, Object)</code></a> method.</dd><dd><code>R</code> - Type of the task result returning from <a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)"><code>reduce(List)</code></a> method.</dd></dl> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></dd> |
| </dl> |
| <dl> |
| <dt>All Known Implementing Classes:</dt> |
| <dd><a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute">ComputeTaskAdapter</a>, <a href="../../../../org/apache/ignite/compute/ComputeTaskSplitAdapter.html" title="class in org.apache.ignite.compute">ComputeTaskSplitAdapter</a>, <a href="../../../../org/apache/ignite/compute/gridify/aop/GridifyDefaultRangeTask.html" title="class in org.apache.ignite.compute.gridify.aop">GridifyDefaultRangeTask</a>, <a href="../../../../org/apache/ignite/compute/gridify/aop/GridifyDefaultTask.html" title="class in org.apache.ignite.compute.gridify.aop">GridifyDefaultTask</a>, <a href="../../../../org/apache/ignite/compute/gridify/GridifyTaskAdapter.html" title="class in org.apache.ignite.compute.gridify">GridifyTaskAdapter</a>, <a href="../../../../org/apache/ignite/compute/gridify/GridifyTaskSplitAdapter.html" title="class in org.apache.ignite.compute.gridify">GridifyTaskSplitAdapter</a>, <a href="../../../../org/apache/ignite/igfs/mapreduce/IgfsTask.html" title="class in org.apache.ignite.igfs.mapreduce">IgfsTask</a>, <a href="../../../../org/apache/ignite/igfs/mapreduce/IgfsTaskNoReduceAdapter.html" title="class in org.apache.ignite.igfs.mapreduce">IgfsTaskNoReduceAdapter</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="strong">ComputeTask<T,R></span> |
| extends <a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a></pre> |
| <div class="block">Grid task interface defines a task that can be executed on the grid. Grid task |
| is responsible for splitting business logic into multiple grid jobs, receiving |
| results from individual grid jobs executing on remote nodes, and reducing |
| (aggregating) received jobs' results into final grid task result. |
| <p> |
| <h1 class="header">Grid Task Execution Sequence</h1> |
| <ol> |
| <li> |
| Upon request to execute a grid task with given task name system will find |
| deployed task with given name. Task needs to be deployed prior to execution |
| (see <a href="../../../../org/apache/ignite/IgniteCompute.html#localDeployTask(java.lang.Class,%20java.lang.ClassLoader)"><code>IgniteCompute.localDeployTask(Class, ClassLoader)</code></a> method), however if task does not specify |
| its name explicitly via <a href="../../../../org/apache/ignite/compute/ComputeTaskName.html" title="annotation in org.apache.ignite.compute"><code>@ComputeTaskName</code></a> annotation, it |
| will be auto-deployed first time it gets executed. |
| </li> |
| <li> |
| System will create new distributed task session (see <a href="../../../../org/apache/ignite/compute/ComputeTaskSession.html" title="interface in org.apache.ignite.compute"><code>ComputeTaskSession</code></a>). |
| </li> |
| <li> |
| System will inject all annotated resources (including task session) into grid task instance. |
| See <a href="../../../../org/apache/ignite/resources/package-summary.html"><code>org.apache.ignite.resources</code></a> package for the list of injectable resources. |
| </li> |
| <li> |
| System will apply <a href="../../../../org/apache/ignite/compute/ComputeTask.html#map(java.util.List,%20T)"><code>map(List, Object)</code></a>. This |
| method is responsible for splitting business logic of grid task into |
| multiple grid jobs (units of execution) and mapping them to |
| grid nodes. Method <a href="../../../../org/apache/ignite/compute/ComputeTask.html#map(java.util.List,%20T)"><code>map(List, Object)</code></a> returns |
| a map of with grid jobs as keys and grid node as values. |
| </li> |
| <li> |
| System will send mapped grid jobs to their respective nodes. |
| </li> |
| <li> |
| Upon arrival on the remote node a grid job will be handled by collision SPI |
| (see <a href="../../../../org/apache/ignite/spi/collision/CollisionSpi.html" title="interface in org.apache.ignite.spi.collision"><code>CollisionSpi</code></a>) which will determine how a job will be executed |
| on the remote node (immediately, buffered or canceled). |
| </li> |
| <li> |
| Once job execution results become available method <a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)"><code>result(ComputeJobResult, List)</code></a> |
| will be called for each received job result. The policy returned by this method will |
| determine the way task reacts to every job result: |
| <ul> |
| <li> |
| If <a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html#WAIT"><code>ComputeJobResultPolicy.WAIT</code></a> policy is returned, task will continue to wait |
| for other job results. If this result is the last job result, then |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)"><code>reduce(List)</code></a> method will be called. |
| </li> |
| <li> |
| If <a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html#REDUCE"><code>ComputeJobResultPolicy.REDUCE</code></a> policy is returned, then method |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)"><code>reduce(List)</code></a> will be called right away without waiting for |
| other jobs' completion (all remaining jobs will receive a cancel request). |
| </li> |
| <li> |
| If <a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html#FAILOVER"><code>ComputeJobResultPolicy.FAILOVER</code></a> policy is returned, then job will |
| be failed over to another node for execution. The node to which job will get |
| failed over is decided by <a href="../../../../org/apache/ignite/spi/failover/FailoverSpi.html" title="interface in org.apache.ignite.spi.failover"><code>FailoverSpi</code></a> SPI implementation. |
| Note that if you use <a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute"><code>ComputeTaskAdapter</code></a> adapter for <code>ComputeTask</code> |
| implementation, then it will automatically fail jobs to another node for 2 |
| known failure cases: |
| <ul> |
| <li> |
| Job has failed due to node crash. In this case <a href="../../../../org/apache/ignite/compute/ComputeJobResult.html#getException()"><code>ComputeJobResult.getException()</code></a> |
| method will return an instance of <a href="../../../../org/apache/ignite/cluster/ClusterTopologyException.html" title="class in org.apache.ignite.cluster"><code>ClusterTopologyException</code></a> exception. |
| </li> |
| <li> |
| Job execution was rejected, i.e. remote node has cancelled job before it got |
| a chance to execute, while it still was on the waiting list. In this case |
| <a href="../../../../org/apache/ignite/compute/ComputeJobResult.html#getException()"><code>ComputeJobResult.getException()</code></a> method will return an instance of |
| <a href="../../../../org/apache/ignite/compute/ComputeExecutionRejectedException.html" title="class in org.apache.ignite.compute"><code>ComputeExecutionRejectedException</code></a> exception. |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li> |
| Once all results are received or <a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)"><code>result(ComputeJobResult, List)</code></a> |
| method returned <a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html#REDUCE"><code>ComputeJobResultPolicy.REDUCE</code></a> policy, method <a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)"><code>reduce(List)</code></a> |
| is called to aggregate received results into one final result. Once this method is finished the |
| execution of the grid task is complete. This result will be returned to the user through |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method. |
| </li> |
| </ol> |
| <p> |
| <h1 class="header">Continuous Job Mapper</h1> |
| For cases when jobs within split are too large to fit in memory at once or when |
| simply not all jobs in task are known during <a href="../../../../org/apache/ignite/compute/ComputeTask.html#map(java.util.List,%20T)"><code>map(List, Object)</code></a> step, |
| use <a href="../../../../org/apache/ignite/compute/ComputeTaskContinuousMapper.html" title="interface in org.apache.ignite.compute"><code>ComputeTaskContinuousMapper</code></a> to continuously stream jobs from task even after <code>map(...)</code> |
| step is complete. Usually with continuous mapper the number of jobs within task |
| may grow too large - in this case it may make sense to use it in combination with |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskNoResultCache.html" title="annotation in org.apache.ignite.compute"><code>@ComputeTaskNoResultCache</code></a> annotation. |
| <p> |
| <h1 class="header">Task Result Caching</h1> |
| Sometimes job results are too large or task simply has too many jobs to keep track |
| of which may hinder performance. In such cases it may make sense to disable task |
| result caching by attaching <a href="../../../../org/apache/ignite/compute/ComputeTaskNoResultCache.html" title="annotation in org.apache.ignite.compute"><code>@ComputeTaskNoResultCache</code></a> annotation to task class, and |
| processing all results as they come in <a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)"><code>result(ComputeJobResult, List)</code></a> method. |
| When Ignite sees this annotation it will disable tracking of job results and |
| list of all job results passed into <a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)"><code>result(ComputeJobResult, List)</code></a> or |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)"><code>reduce(List)</code></a> methods will always be empty. Note that list of |
| job siblings on <a href="../../../../org/apache/ignite/compute/ComputeTaskSession.html" title="interface in org.apache.ignite.compute"><code>ComputeTaskSession</code></a> will also be empty to prevent number |
| of job siblings from growing as well. |
| <p> |
| <h1 class="header">Resource Injection</h1> |
| Grid task implementation can be injected using IoC (dependency injection) with |
| ignite resources. Both, field and method based injection are supported. |
| The following ignite resources can be injected: |
| <ul> |
| <li><a href="../../../../org/apache/ignite/resources/TaskSessionResource.html" title="annotation in org.apache.ignite.resources"><code>TaskSessionResource</code></a></li> |
| <li><a href="../../../../org/apache/ignite/resources/IgniteInstanceResource.html" title="annotation in org.apache.ignite.resources"><code>IgniteInstanceResource</code></a></li> |
| <li><a href="../../../../org/apache/ignite/resources/LoggerResource.html" title="annotation in org.apache.ignite.resources"><code>LoggerResource</code></a></li> |
| <li><a href="../../../../org/apache/ignite/resources/SpringApplicationContextResource.html" title="annotation in org.apache.ignite.resources"><code>SpringApplicationContextResource</code></a></li> |
| <li><a href="../../../../org/apache/ignite/resources/SpringResource.html" title="annotation in org.apache.ignite.resources"><code>SpringResource</code></a></li> |
| </ul> |
| Refer to corresponding resource documentation for more information. |
| <p> |
| <h1 class="header">Grid Task Adapters</h1> |
| <code>ComputeTask</code> comes with several convenience adapters to make the usage easier: |
| <ul> |
| <li> |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute"><code>ComputeTaskAdapter</code></a> provides default implementation for <a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)"><code>result(ComputeJobResult, List)</code></a> |
| method which provides automatic fail-over to another node if remote job has failed |
| due to node crash (detected by <a href="../../../../org/apache/ignite/cluster/ClusterTopologyException.html" title="class in org.apache.ignite.cluster"><code>ClusterTopologyException</code></a> exception) or due to job |
| execution rejection (detected by <a href="../../../../org/apache/ignite/compute/ComputeExecutionRejectedException.html" title="class in org.apache.ignite.compute"><code>ComputeExecutionRejectedException</code></a> exception). |
| Here is an example of how a you would implement your task using <a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute"><code>ComputeTaskAdapter</code></a>: |
| <pre name="code" class="java"> |
| public class MyFooBarTask extends ComputeTaskAdapter<String, String> { |
| // Inject load balancer. |
| @LoadBalancerResource |
| ComputeLoadBalancer balancer; |
| |
| // Map jobs to grid nodes. |
| public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, String arg) throws IgniteCheckedException { |
| Map<MyFooBarJob, ClusterNode> jobs = new HashMap<MyFooBarJob, ClusterNode>(subgrid.size()); |
| |
| // In more complex cases, you can actually do |
| // more complicated assignments of jobs to nodes. |
| for (int i = 0; i < subgrid.size(); i++) { |
| // Pick the next best balanced node for the job. |
| jobs.put(new MyFooBarJob(arg), balancer.getBalancedNode()) |
| } |
| |
| return jobs; |
| } |
| |
| // Aggregate results into one compound result. |
| public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException { |
| // For the purpose of this example we simply |
| // concatenate string representation of every |
| // job result |
| StringBuilder buf = new StringBuilder(); |
| |
| for (ComputeJobResult res : results) { |
| // Append string representation of result |
| // returned by every job. |
| buf.append(res.getData().string()); |
| } |
| |
| return buf.string(); |
| } |
| } |
| </pre> |
| </li> |
| <li> |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskSplitAdapter.html" title="class in org.apache.ignite.compute"><code>ComputeTaskSplitAdapter</code></a> hides the job-to-node mapping logic from |
| user and provides convenient <a href="../../../../org/apache/ignite/compute/ComputeTaskSplitAdapter.html#split(int,%20T)"><code>ComputeTaskSplitAdapter.split(int, Object)</code></a> |
| method for splitting task into sub-jobs in homogeneous environments. |
| Here is an example of how you would implement your task using <a href="../../../../org/apache/ignite/compute/ComputeTaskSplitAdapter.html" title="class in org.apache.ignite.compute"><code>ComputeTaskSplitAdapter</code></a>: |
| <pre name="code" class="java"> |
| public class MyFooBarTask extends ComputeTaskSplitAdapter<Object, String> { |
| @Override |
| protected Collection<? extends ComputeJob> split(int gridSize, Object arg) throws IgniteCheckedException { |
| List<MyFooBarJob> jobs = new ArrayList<MyFooBarJob>(gridSize); |
| |
| for (int i = 0; i < gridSize; i++) { |
| jobs.add(new MyFooBarJob(arg)); |
| } |
| |
| // Node assignment via load balancer |
| // happens automatically. |
| return jobs; |
| } |
| |
| // Aggregate results into one compound result. |
| public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException { |
| // For the purpose of this example we simply |
| // concatenate string representation of every |
| // job result |
| StringBuilder buf = new StringBuilder(); |
| |
| for (ComputeJobResult res : results) { |
| // Append string representation of result |
| // returned by every job. |
| buf.append(res.getData().string()); |
| } |
| |
| return buf.string(); |
| } |
| } |
| </pre> |
| </li> |
| </ul></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method_summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span>Methods</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><? extends <a href="../../../../org/apache/ignite/compute/ComputeJob.html" title="interface in org.apache.ignite.compute">ComputeJob</a>,<a href="../../../../org/apache/ignite/cluster/ClusterNode.html" title="interface in org.apache.ignite.cluster">ClusterNode</a>></code></td> |
| <td class="colLast"><code><strong><a href="../../../../org/apache/ignite/compute/ComputeTask.html#map(java.util.List,%20T)">map</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/cluster/ClusterNode.html" title="interface in org.apache.ignite.cluster">ClusterNode</a>> subgrid, |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html" title="type parameter in ComputeTask">T</a> arg)</code> |
| <div class="block">This method is called to map or split grid task into multiple grid jobs.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/ignite/compute/ComputeTask.html" title="type parameter in ComputeTask">R</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../org/apache/ignite/compute/ComputeTask.html#reduce(java.util.List)">reduce</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a>> results)</code> |
| <div class="block">Reduces (or aggregates) results received so far into one compound result to be returned to |
| caller via <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html" title="enum in org.apache.ignite.compute">ComputeJobResultPolicy</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../../org/apache/ignite/compute/ComputeTask.html#result(org.apache.ignite.compute.ComputeJobResult,%20java.util.List)">result</a></strong>(<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a> res, |
| <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a>> rcvd)</code> |
| <div class="block">Asynchronous callback invoked every time a result from remote execution is |
| received.</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="map(java.util.List,java.lang.Object)"> |
| <!-- --> |
| </a><a name="map(java.util.List, T)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>map</h4> |
| <pre>@Nullable |
| <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><? extends <a href="../../../../org/apache/ignite/compute/ComputeJob.html" title="interface in org.apache.ignite.compute">ComputeJob</a>,<a href="../../../../org/apache/ignite/cluster/ClusterNode.html" title="interface in org.apache.ignite.cluster">ClusterNode</a>> map(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/cluster/ClusterNode.html" title="interface in org.apache.ignite.cluster">ClusterNode</a>> subgrid, |
| @Nullable |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html" title="type parameter in ComputeTask">T</a> arg) |
| throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">This method is called to map or split grid task into multiple grid jobs. This is the |
| first method that gets called when task execution starts.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>arg</code> - Task execution argument. Can be <code>null</code>. This is the same argument |
| as the one passed into <code>Grid#execute(...)</code> methods.</dd><dd><code>subgrid</code> - Nodes available for this task execution. Note that order of nodes is |
| guaranteed to be randomized by container. This ensures that every time |
| you simply iterate through grid nodes, the order of nodes will be random which |
| over time should result into all nodes being used equally.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>Map of grid jobs assigned to subgrid node. Unless <a href="../../../../org/apache/ignite/compute/ComputeTaskContinuousMapper.html" title="interface in org.apache.ignite.compute"><code>ComputeTaskContinuousMapper</code></a> is |
| injected into task, if <code>null</code> or empty map is returned, exception will be thrown.</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 mapping could not complete successfully. This exception will be |
| thrown out of <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method.</dd></dl> |
| </li> |
| </ul> |
| <a name="result(org.apache.ignite.compute.ComputeJobResult, java.util.List)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>result</h4> |
| <pre><a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html" title="enum in org.apache.ignite.compute">ComputeJobResultPolicy</a> result(<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a> res, |
| <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a>> rcvd) |
| throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Asynchronous callback invoked every time a result from remote execution is |
| received. It is ultimately upto this method to return a policy based |
| on which the system will either wait for more results, reduce results |
| received so far, or failover this job to another node. See |
| <a href="../../../../org/apache/ignite/compute/ComputeJobResultPolicy.html" title="enum in org.apache.ignite.compute"><code>ComputeJobResultPolicy</code></a> for more information about result policies.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>res</code> - Received remote grid executable result.</dd><dd><code>rcvd</code> - All previously received results. Note that if task class has |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskNoResultCache.html" title="annotation in org.apache.ignite.compute"><code>ComputeTaskNoResultCache</code></a> annotation, then this list will be empty.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>Result policy that dictates how to process further upcoming |
| job results.</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 handling a job result caused an error. This exception will |
| be thrown out of <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method.</dd></dl> |
| </li> |
| </ul> |
| <a name="reduce(java.util.List)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>reduce</h4> |
| <pre>@Nullable |
| <a href="../../../../org/apache/ignite/compute/ComputeTask.html" title="type parameter in ComputeTask">R</a> reduce(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../org/apache/ignite/compute/ComputeJobResult.html" title="interface in org.apache.ignite.compute">ComputeJobResult</a>> results) |
| throws <a href="../../../../org/apache/ignite/IgniteException.html" title="class in org.apache.ignite">IgniteException</a></pre> |
| <div class="block">Reduces (or aggregates) results received so far into one compound result to be returned to |
| caller via <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method. |
| <p> |
| Note, that if some jobs did not succeed and could not be failed over then the list of |
| results passed into this method will include the failed results. Otherwise, failed |
| results will not be in the list.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>results</code> - Received results of broadcasted remote executions. Note that if task class has |
| <a href="../../../../org/apache/ignite/compute/ComputeTaskNoResultCache.html" title="annotation in org.apache.ignite.compute"><code>ComputeTaskNoResultCache</code></a> annotation, then this list will be empty.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>Grid job result constructed from results of remote executions.</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 reduction or results caused an error. This exception will |
| be thrown out of <a href="../../../../org/apache/ignite/compute/ComputeTaskFuture.html#get()"><code>ComputeTaskFuture.get()</code></a> method.</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/ComputeTask.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><a href="../../../../org/apache/ignite/compute/ComputeLoadBalancer.html" title="interface in org.apache.ignite.compute"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/ignite/compute/ComputeTaskAdapter.html" title="class in org.apache.ignite.compute"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/ignite/compute/ComputeTask.html" target="_top">Frames</a></li> |
| <li><a href="ComputeTask.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip-navbar_bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small><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 © 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>: ver. <strong>1.6.0</strong> </td> </tr> <tr style="padding: 0; margin: 0"> <td> <b>Release Date</b> </td> <td>: May 18 2016 </td> </tr> </tbody> </table> </td> </tr> </table></small></p> |
| </body> |
| </html> |