Package org.apache.ignite.compute

## Interface ComputeTaskContinuousMapper

-     public interface ComputeTaskContinuousMapper

  Defines a mapper that can be used for asynchronous job sending. Useful for streaming jobs within the same task. Note that if job number within a task grows too large, it is best to attach `ComputeTaskNoResultCache` annotation to task to make sure that collection of job results and job siblings does not grow indefinitely.

  Continuous mapper methods can be used right after it injected into a task. Mapper can not be used after `ComputeTask.result(ComputeJobResult, List)` method returned the `ComputeJobResultPolicy.REDUCE` policy. Also if `ComputeTask.result(ComputeJobResult, List)` method returned the `ComputeJobResultPolicy.WAIT` policy and all jobs are finished then task will go to reducing results and continuous mapper can not be used.

  Note that whenever continuous mapper is used, `ComputeTask.map(List, Object)` method is allowed to return `null` in case when at least one job has been sent prior to completing the `ComputeTask.map(List, Object)` method.

  Task continuous mapper can be injected into a task using IoC (dependency injection) by attaching `TaskContinuousMapperResource` annotation to a field or a setter method inside of `ComputeTask` implementations as follows:

       ...
       // This field will be injected with task continuous mapper.
       @TaskContinuousMapperResource
       private ComputeTaskContinuousMapper mapper;
       ...

  or from a setter method:

       // This setter method will be automatically called by the system
       // to set grid task continuous mapper.
       @TaskContinuousMapperResource
       void setSession(ComputeTaskContinuousMapper mapper) {
           this.mapper = mapper;
       }

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `send​(Collection<? extends ComputeJob> jobs)` | Sends collection of jobs to nodes automatically picked by the underlying load balancer.
    `void` | `send​(Map<? extends ComputeJob,​ClusterNode> mappedJobs)` | Sends collection of grid jobs to assigned nodes.
    `void` | `send​(ComputeJob job)` | Sends job to a node automatically picked by the underlying load balancer.
    `void` | `send​(ComputeJob job, ClusterNode node)` | Sends given job to a specific grid node.

- - ### Method Detail

    - #### send

          void send​(ComputeJob job,
                    ClusterNode node)
             throws IgniteException

      Sends given job to a specific grid node.
      Parameters:
        `job` - Job instance to send. If `null` is passed, exception will be thrown.
        `node` - Grid node. If `null` is passed, exception will be thrown.
      Throws:
        `IgniteException` - If job can not be processed.

    - #### send

          void send​(Map<? extends ComputeJob,​ClusterNode> mappedJobs)
             throws IgniteException

      Sends collection of grid jobs to assigned nodes.
      Parameters:
        `mappedJobs` - Map of grid jobs assigned to grid node. If `null` or empty list is passed, exception will be thrown.
      Throws:
        `IgniteException` - If job can not be processed.

    - #### send

          void send​(ComputeJob job)
             throws IgniteException

      Sends job to a node automatically picked by the underlying load balancer.
      Parameters:
        `job` - Job instance to send. If `null` is passed, exception will be thrown.
      Throws:
        `IgniteException` - If job can not be processed.

    - #### send

          void send​(Collection<? extends ComputeJob> jobs)
             throws IgniteException

      Sends collection of jobs to nodes automatically picked by the underlying load balancer.
      Parameters:
        `jobs` - Collection of grid job instances. If `null` or empty list is passed, exception will be thrown.
      Throws:
        `IgniteException` - If job can not be processed.