Class IgniteRemoteMapTask<T,R>
- java.lang.Object
-
- org.apache.ignite.compute.ComputeTaskAdapter<T,R>
-
- org.apache.ignite.internal.util.future.IgniteRemoteMapTask<T,R>
-
- All Implemented Interfaces:
Serializable,ComputeTask<T,R>
@GridInternal public class IgniteRemoteMapTask<T,R> extends ComputeTaskAdapter<T,R>
Util task that will execute ComputeTask on a given node.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IgniteRemoteMapTask(ClusterNode node, ComputeTask<T,R> remoteTask)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Map<? extends ComputeJob,ClusterNode>map(List<ClusterNode> subgrid, T arg)This method is called to map or split grid task into multiple grid jobs.Rreduce(List<ComputeJobResult> results)Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()method.-
Methods inherited from class org.apache.ignite.compute.ComputeTaskAdapter
result
-
-
-
-
Constructor Detail
-
IgniteRemoteMapTask
public IgniteRemoteMapTask(ClusterNode node, ComputeTask<T,R> remoteTask)
- Parameters:
node- Target node.remoteTask- Delegate task.
-
-
Method Detail
-
map
@NotNull public @NotNull Map<? extends ComputeJob,ClusterNode> map(List<ClusterNode> subgrid, @Nullable T arg) throws IgniteException
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.- Parameters:
subgrid- 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.arg- Task execution argument. Can benull. This is the same argument as the one passed intoGrid#execute(...)methods.- Returns:
- Map of grid jobs assigned to subgrid node. Unless
ComputeTaskContinuousMapperis injected into task, ifnullor empty map is returned, exception will be thrown. - Throws:
IgniteException- If mapping could not complete successfully. This exception will be thrown out ofComputeTaskFuture.get()method.
-
reduce
@Nullable public R reduce(List<ComputeJobResult> results) throws IgniteException
Reduces (or aggregates) results received so far into one compound result to be returned to caller viaComputeTaskFuture.get()method.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.
- Parameters:
results- Received results of broadcasted remote executions. Note that if task class hasComputeTaskNoResultCacheannotation, then this list will be empty.- Returns:
- Grid job result constructed from results of remote executions.
- Throws:
IgniteException- If reduction or results caused an error. This exception will be thrown out ofComputeTaskFuture.get()method.
-
-