org.apache.ignite.compute.gridify.aop

## Class GridifyDefaultTask

- java.lang.Object
- - org.apache.ignite.compute.ComputeTaskAdapter<GridifyArgument,Object>
  - - org.apache.ignite.compute.gridify.aop.GridifyDefaultTask

- All Implemented Interfaces:
    Serializable, ComputeTask<GridifyArgument,Object>, org.apache.ignite.internal.util.lang.GridPeerDeployAware

      public class GridifyDefaultTask
      extends ComputeTaskAdapter<GridifyArgument,Object>
      implements org.apache.ignite.internal.util.lang.GridPeerDeployAware

  Default gridify task which simply executes a method on remote node.

  See `Gridify` documentation for more information about execution of `gridified` methods.

  See Also:
    `Gridify`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GridifyDefaultTask(Class<?> cls)` Creates gridify default task with given deployment class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ClassLoader` | `classLoader()` Gets class loader for the class.
    `Class<?>` | `deployClass()` Gets top level user class being deployed.
    `@NotNull Map<? extends ComputeJob,ClusterNode>` | `map(List<ClusterNode> subgrid, GridifyArgument arg)` This method is called to map or split grid task into multiple grid jobs.
    `Object` | `reduce(List<ComputeJobResult> results)` Reduces (or aggregates) results received so far into one compound result to be returned to caller via `ComputeTaskFuture.get()` method.

    - ### Methods inherited from class org.apache.ignite.compute.ComputeTaskAdapter

      `result`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GridifyDefaultTask

          public GridifyDefaultTask(Class<?> cls)

      Creates gridify default task with given deployment class.
      Parameters:
        `cls` - Deployment class for peer-deployment.

  - ### Method Detail

    - #### deployClass

          public Class<?> deployClass()

      Gets top level user class being deployed.
      Specified by:
        `deployClass` in interface `org.apache.ignite.internal.util.lang.GridPeerDeployAware`
      Returns:
        Top level user deployed class.

    - #### classLoader

          public ClassLoader classLoader()

      Gets class loader for the class. This class loader must be able to load the class returned from `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.

      Specified by:
        `classLoader` in interface `org.apache.ignite.internal.util.lang.GridPeerDeployAware`
      Returns:
        Class loader for the class.

    - #### map

          @NotNull
          public @NotNull Map<? extends ComputeJob,ClusterNode> map(List<ClusterNode> subgrid,
                                                                             GridifyArgument arg)

      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.
      Specified by:
        `map` in interface `ComputeTask<GridifyArgument,Object>`
      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 be `null`. This is the same argument as the one passed into `Grid#execute(...)` methods.
      Returns:
        Map of grid jobs assigned to subgrid node. Unless `ComputeTaskContinuousMapper` is injected into task, if `null` or empty map is returned, exception will be thrown.

    - #### reduce

          public final Object reduce(List<ComputeJobResult> results)

      Reduces (or aggregates) results received so far into one compound result to be returned to caller via `ComputeTaskFuture.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.

      Specified by:
        `reduce` in interface `ComputeTask<GridifyArgument,Object>`
      Parameters:
        `results` - Received results of broadcasted remote executions. Note that if task class has `ComputeTaskNoResultCache` annotation, then this list will be empty.
      Returns:
        Grid job result constructed from results of remote executions.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022