@GridComputeTaskNoResultCache public class GridStreamerReduceTask<R1,R2> extends GridPeerDeployAwareTaskAdapter<Void,R2>
| Constructor and Description |
|---|
GridStreamerReduceTask(GridClosure<GridStreamerContext,R1> clos,
GridReducer<R1,R2> rdc,
String streamer) |
| Modifier and Type | Method and Description |
|---|---|
Map<? extends GridComputeJob,GridNode> |
map(List<GridNode> subgrid,
Void arg)
This method is called to map or split grid task into multiple grid jobs.
|
R2 |
reduce(List<GridComputeJobResult> results)
Reduces (or aggregates) results received so far into one compound result to be returned to
caller via
GridComputeTaskFuture.get() method. |
GridComputeJobResultPolicy |
result(GridComputeJobResult res,
List<GridComputeJobResult> rcvd)
Default implementation which will wait for all jobs to complete before
calling
GridComputeTask.reduce(List) method. |
classLoader, deployClasspublic GridStreamerReduceTask(GridClosure<GridStreamerContext,R1> clos, GridReducer<R1,R2> rdc, @Nullable String streamer)
clos - Query closure.rdc - Query reducer.streamer - Streamer.public Map<? extends GridComputeJob,GridNode> map(List<GridNode> subgrid, @Nullable Void arg) throws GridException
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 be null. This is the same argument
as the one passed into Grid#execute(...) methods.GridComputeTaskContinuousMapper is
injected into task, if null or empty map is returned, exception will be thrown.GridException - If mapping could not complete successfully. This exception will be
thrown out of GridComputeTaskFuture.get() method.public R2 reduce(List<GridComputeJobResult> results) throws GridException
GridComputeTaskFuture.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.
results - Received results of broadcasted remote executions. Note that if task class has
GridComputeTaskNoResultCache annotation, then this list will be empty.GridException - If reduction or results caused an error. This exception will
be thrown out of GridComputeTaskFuture.get() method.public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException
GridComputeTask.reduce(List) method.
If remote job resulted in exception (GridComputeJobResult.getException() is not null),
then GridComputeJobResultPolicy.FAILOVER policy will be returned if the exception is instance
of GridTopologyException or GridComputeExecutionRejectedException, which means that
remote node either failed or job execution was rejected before it got a chance to start. In all
other cases the exception will be rethrown which will ultimately cause task to fail.
result in interface GridComputeTask<Void,R2>result in class GridComputeTaskAdapter<Void,R2>res - Received remote grid executable result.rcvd - All previously received results.GridException - If handling a job result caused an error effectively rejecting
a failover. This exception will be thrown out of GridComputeTaskFuture.get() method.Copyright © 2014. All rights reserved.