public class GridifyDefaultRangeTask extends GridComputeTaskAdapter<GridifyRangeArgument,Collection<?>> implements GridPeerDeployAware
Gridify documentation for more information about execution of gridified methods.GridifySetToSet,
GridifySetToValue,
Serialized Form| Constructor and Description |
|---|
GridifyDefaultRangeTask(Class<?> cls,
GridifyNodeFilter nodeFilter,
int threshold,
int splitSize,
boolean limitedSplit) |
| Modifier and Type | Method and Description |
|---|---|
ClassLoader |
classLoader()
Gets class loader for the class.
|
Class<?> |
deployClass()
Gets top level user class being deployed.
|
Map<? extends GridComputeJob,GridNode> |
map(List<GridNode> subgrid,
GridifyRangeArgument arg)
This method is called to map or split grid task into multiple grid jobs.
|
Collection<?> |
reduce(List<GridComputeJobResult> results)
Reduces (or aggregates) results received so far into one compound result to be returned to
caller via
GridComputeTaskFuture.get() method. |
resultpublic GridifyDefaultRangeTask(Class<?> cls, GridifyNodeFilter nodeFilter, int threshold, int splitSize, boolean limitedSplit)
cls - Deployment class.nodeFilter - Predicate node filter.threshold - Parameter that defines the minimal value below which the
execution will NOT be grid-enabled.splitSize - Split size for job arguments.limitedSplit - Indicates limitation for split algorithm.public Class<?> deployClass()
deployClass in interface GridPeerDeployAwarepublic ClassLoader classLoader()
GridPeerDeployAware.deployClass() as well as all of its
dependencies.
Note that in most cases the class loader returned from this method
and the class loader for the class returned from GridPeerDeployAware.deployClass() method
will be the same. If they are not the same, it is required that the class loader
returned from this method still has to be able to load the deploy class and all its
dependencies.
classLoader in interface GridPeerDeployAwarepublic Map<? extends GridComputeJob,GridNode> map(List<GridNode> subgrid, GridifyRangeArgument arg) throws GridException
map in interface GridComputeTask<GridifyRangeArgument,Collection<?>>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 final Collection<?> 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.
reduce in interface GridComputeTask<GridifyRangeArgument,Collection<?>>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.Copyright © 2014. All rights reserved.