Class ComputeMapReduceExample.PhraseWordLengthCountMapReduceTask
java.lang.Object
org.apache.ignite.example.compute.ComputeMapReduceExample.PhraseWordLengthCountMapReduceTask
- All Implemented Interfaces:
MapReduceTask<String,String, Integer, Integer>
- Enclosing class:
- ComputeMapReduceExample
public static class ComputeMapReduceExample.PhraseWordLengthCountMapReduceTask
extends Object
implements MapReduceTask<String,String,Integer,Integer>
MapReduce task that splits the input phrase into words and sends them to different nodes for the processing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreduceAsync(TaskExecutionContext taskContext, Map<UUID, Integer> results) This is a finishing step in the task execution.splitAsync(TaskExecutionContext taskContext, String input) This method should return a list of compute job execution parameters which will be used to submit compute jobs.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.ignite.compute.task.MapReduceTask
reduceJobResultMarshaller, splitJobInputMarshaller
-
Constructor Details
-
PhraseWordLengthCountMapReduceTask
public PhraseWordLengthCountMapReduceTask()
-
-
Method Details
-
splitAsync
public CompletableFuture<List<MapReduceJob<String,Integer>>> splitAsync(TaskExecutionContext taskContext, String input) This method should return a list of compute job execution parameters which will be used to submit compute jobs.- Specified by:
splitAsyncin interfaceMapReduceTask<String,String, Integer, Integer> - Parameters:
taskContext- Task execution context.input- Map reduce task (I)nput.- Returns:
- A future with the list of compute job execution parameters.
-
reduceAsync
public CompletableFuture<Integer> reduceAsync(TaskExecutionContext taskContext, Map<UUID, Integer> results) This is a finishing step in the task execution. This method will be called with the map from identifiers of compute jobs submitted as a result of theMapReduceTask.splitAsync(TaskExecutionContext, Object)method call to the results of the execution of the corresponding job. The resulting map has the same iteration order as the result of the split method. The return value of this method will be returned as a result of this task.- Specified by:
reduceAsyncin interfaceMapReduceTask<String,String, Integer, Integer> - Parameters:
taskContext- Task execution context.results- Map from compute job ids to their results.- Returns:
- Final task result future.
-