org.apache.ignite.internal.processors.closure

## Class GridClosureProcessor

- java.lang.Object
- - org.apache.ignite.internal.processors.GridProcessorAdapter
  - - org.apache.ignite.internal.processors.closure.GridClosureProcessor

All Implemented Interfaces:
  GridComponent, GridProcessor

    public class GridClosureProcessor
    extends GridProcessorAdapter

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`ctx, log`

### Constructor Summary

Constructors
Constructor and Description
`GridClosureProcessor(GridKernalContext ctx)`

### Method Summary

Methods
`<R> ComputeTaskInternalFuture<R>` `affinityCall(String cacheName, Object affKey, Callable<R> job, Collection<ClusterNode> nodes)`
`ComputeTaskInternalFuture<?>` `affinityRun(String cacheName, Object affKey, Runnable job, Collection<ClusterNode> nodes)`
`<T,R> IgniteInternalFuture<Collection<R>>` `broadcast(IgniteClosure<T,R> job, T arg, Collection<ClusterNode> nodes)`
`<T,R> IgniteInternalFuture<Collection<R>>` `broadcastNoFailover(IgniteClosure<T,R> job, T arg, Collection<ClusterNode> nodes)`
`<R> ComputeTaskInternalFuture<R>` `callAsync(GridClosureCallMode mode, Callable<R> job, Collection<ClusterNode> nodes)`
`<R> ComputeTaskInternalFuture<R>` `callAsync(GridClosureCallMode mode, Callable<R> job, Collection<ClusterNode> nodes, boolean sys)`
`<R> ComputeTaskInternalFuture<Collection<R>>` `callAsync(GridClosureCallMode mode, Collection<? extends Callable<R>> jobs, Collection<ClusterNode> nodes)`
`<R> ComputeTaskInternalFuture<Collection<R>>` `callAsync(GridClosureCallMode mode, Collection<? extends Callable<R>> jobs, Collection<ClusterNode> nodes, boolean sys)`
`<T,R> ComputeTaskInternalFuture<Collection<R>>` `callAsync(IgniteClosure<T,R> job, Collection<? extends T> args, Collection<ClusterNode> nodes)`
`<T,R> ComputeTaskInternalFuture<R>` `callAsync(IgniteClosure<T,R> job, T arg, Collection<ClusterNode> nodes)`
`<T,R1,R2> ComputeTaskInternalFuture<R2>` `callAsync(IgniteClosure<T,R1> job, Collection<? extends T> args, IgniteReducer<R1,R2> rdc, Collection<ClusterNode> nodes)`
`<R> IgniteInternalFuture<R>` `callAsyncNoFailover(GridClosureCallMode mode, Callable<R> job, Collection<ClusterNode> nodes, boolean sys)`
`<R> IgniteInternalFuture<Collection<R>>` `callAsyncNoFailover(GridClosureCallMode mode, Collection<? extends Callable<R>> jobs, Collection<ClusterNode> nodes, boolean sys)`
`<R> IgniteInternalFuture<R>` `callLocalSafe(Callable<R> c)` Executes closure on system pool.
`<R> IgniteInternalFuture<R>` `callLocalSafe(Callable<R> c, boolean sys)` Executes closure on system pool.
`<R> IgniteInternalFuture<R>` `callLocalSafe(Callable<R> c, GridClosurePolicy plc)` Companion to `callLocal(Callable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).
`<R1,R2> ComputeTaskInternalFuture<R2>` `forkjoinAsync(GridClosureCallMode mode, Collection<? extends Callable<R1>> jobs, IgniteReducer<R1,R2> rdc, Collection<ClusterNode> nodes)`
`void` `onKernalStop(boolean cancel)` Callback to notify that kernal is about to stop.
`ComputeTaskInternalFuture<?>` `runAsync(GridClosureCallMode mode, Collection<? extends Runnable> jobs, Collection<ClusterNode> nodes)`
`ComputeTaskInternalFuture<?>` `runAsync(GridClosureCallMode mode, Collection<? extends Runnable> jobs, Collection<ClusterNode> nodes, boolean sys)`
`ComputeTaskInternalFuture<?>` `runAsync(GridClosureCallMode mode, Runnable job, Collection<ClusterNode> nodes)`
`ComputeTaskInternalFuture<?>` `runAsync(GridClosureCallMode mode, Runnable job, Collection<ClusterNode> nodes, boolean sys)`
`IgniteInternalFuture<?>` `runLocalSafe(Runnable c)` Executes closure on system pool.
`IgniteInternalFuture<?>` `runLocalSafe(Runnable c, boolean sys)` Companion to `runLocal(Runnable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).
`IgniteInternalFuture<?>` `runLocalSafe(Runnable c, GridClosurePolicy plc)` Companion to `runLocal(Runnable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).
`void` `start()` Starts grid component.

### Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter

`assertParameter, collectDiscoveryData, discoveryDataType, onDisconnected, onDiscoveryDataReceived, onKernalStart, onReconnected, printMemoryStats, stop, toString, validateNode`

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

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

### Constructor Detail

#### GridClosureProcessor

    public GridClosureProcessor(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Overrides:
  `start` in class `GridProcessorAdapter`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### onKernalStop

    public void onKernalStop(boolean cancel)

Callback to notify that kernal is about to stop.

Specified by:
  `onKernalStop` in interface `GridComponent`
Overrides:
  `onKernalStop` in class `GridProcessorAdapter`
Parameters:
  `cancel` - Flag indicating whether jobs should be canceled.

#### runAsync

    public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode,
                                        @Nullable
                                        Collection<? extends Runnable> jobs,
                                        @Nullable
                                        Collection<ClusterNode> nodes)

Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `nodes` - Grid nodes.
Returns:
  Task execution future.

#### runAsync

    public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode,
                                        Collection<? extends Runnable> jobs,
                                        @Nullable
                                        Collection<ClusterNode> nodes,
                                        boolean sys)

Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Task execution future.

#### runAsync

    public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode,
                                        Runnable job,
                                        @Nullable
                                        Collection<ClusterNode> nodes)

Parameters:
  `mode` - Distribution mode.
  `job` - Closure to execute.
  `nodes` - Grid nodes.
Returns:
  Task execution future.

#### runAsync

    public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode,
                                        Runnable job,
                                        @Nullable
                                        Collection<ClusterNode> nodes,
                                        boolean sys)

Parameters:
  `mode` - Distribution mode.
  `job` - Closure to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Task execution future.

#### forkjoinAsync

    public <R1,R2> ComputeTaskInternalFuture<R2> forkjoinAsync(GridClosureCallMode mode,
                                                      Collection<? extends Callable<R1>> jobs,
                                                      IgniteReducer<R1,R2> rdc,
                                                      @Nullable
                                                      Collection<ClusterNode> nodes)

Type Parameters:
  `R1` - Type.
  `R2` - Type.
Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `rdc` - Reducer.
  `nodes` - Grid nodes.
Returns:
  Reduced result.

#### callAsync

    public <R> ComputeTaskInternalFuture<Collection<R>> callAsync(GridClosureCallMode mode,
                                                         @Nullable
                                                         Collection<? extends Callable<R>> jobs,
                                                         @Nullable
                                                         Collection<ClusterNode> nodes)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `nodes` - Grid nodes.
Returns:
  Grid future for collection of closure results.

#### callAsync

    public <R> ComputeTaskInternalFuture<Collection<R>> callAsync(GridClosureCallMode mode,
                                                         Collection<? extends Callable<R>> jobs,
                                                         @Nullable
                                                         Collection<ClusterNode> nodes,
                                                         boolean sys)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Grid future for collection of closure results.

#### callAsync

    public <R> ComputeTaskInternalFuture<R> callAsync(GridClosureCallMode mode,
                                             @Nullable
                                             Callable<R> job,
                                             @Nullable
                                             Collection<ClusterNode> nodes)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `job` - Closure to execute.
  `nodes` - Grid nodes.
Returns:
  Grid future for collection of closure results.

#### affinityCall

    public <R> ComputeTaskInternalFuture<R> affinityCall(@Nullable
                                                String cacheName,
                                                Object affKey,
                                                Callable<R> job,
                                                @Nullable
                                                Collection<ClusterNode> nodes)

Parameters:
  `cacheName` - Cache name.
  `affKey` - Affinity key.
  `job` - Job.
  `nodes` - Grid nodes.
Returns:
  Job future.

#### affinityRun

    public ComputeTaskInternalFuture<?> affinityRun(@Nullable
                                           String cacheName,
                                           Object affKey,
                                           Runnable job,
                                           @Nullable
                                           Collection<ClusterNode> nodes)

Parameters:
  `cacheName` - Cache name.
  `affKey` - Affinity key.
  `job` - Job.
  `nodes` - Grid nodes.
Returns:
  Job future.

#### callAsyncNoFailover

    public <R> IgniteInternalFuture<R> callAsyncNoFailover(GridClosureCallMode mode,
                                                  @Nullable
                                                  Callable<R> job,
                                                  @Nullable
                                                  Collection<ClusterNode> nodes,
                                                  boolean sys)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `job` - Closure to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Grid future for collection of closure results.

#### callAsyncNoFailover

    public <R> IgniteInternalFuture<Collection<R>> callAsyncNoFailover(GridClosureCallMode mode,
                                                              @Nullable
                                                              Collection<? extends Callable<R>> jobs,
                                                              @Nullable
                                                              Collection<ClusterNode> nodes,
                                                              boolean sys)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `jobs` - Closures to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Grid future for collection of closure results.

#### callAsync

    public <R> ComputeTaskInternalFuture<R> callAsync(GridClosureCallMode mode,
                                             Callable<R> job,
                                             @Nullable
                                             Collection<ClusterNode> nodes,
                                             boolean sys)

Type Parameters:
  `R` - Type.
Parameters:
  `mode` - Distribution mode.
  `job` - Closure to execute.
  `nodes` - Grid nodes.
  `sys` - If `true`, then system pool will be used.
Returns:
  Grid future for collection of closure results.

#### callAsync

    public <T,R> ComputeTaskInternalFuture<R> callAsync(IgniteClosure<T,R> job,
                                               @Nullable
                                               T arg,
                                               @Nullable
                                               Collection<ClusterNode> nodes)

Parameters:
  `job` - Job closure.
  `arg` - Optional job argument.
  `nodes` - Grid nodes.
Returns:
  Grid future for execution result.

#### broadcast

    public <T,R> IgniteInternalFuture<Collection<R>> broadcast(IgniteClosure<T,R> job,
                                                      @Nullable
                                                      T arg,
                                                      @Nullable
                                                      Collection<ClusterNode> nodes)

Parameters:
  `job` - Job closure.
  `arg` - Optional job argument.
  `nodes` - Grid nodes.
Returns:
  Grid future for execution result.

#### broadcastNoFailover

    public <T,R> IgniteInternalFuture<Collection<R>> broadcastNoFailover(IgniteClosure<T,R> job,
                                                                @Nullable
                                                                T arg,
                                                                @Nullable
                                                                Collection<ClusterNode> nodes)

Parameters:
  `job` - Job closure.
  `arg` - Optional job argument.
  `nodes` - Grid nodes.
Returns:
  Grid future for execution result.

#### callAsync

    public <T,R> ComputeTaskInternalFuture<Collection<R>> callAsync(IgniteClosure<T,R> job,
                                                           @Nullable
                                                           Collection<? extends T> args,
                                                           @Nullable
                                                           Collection<ClusterNode> nodes)

Parameters:
  `job` - Job closure.
  `args` - Job arguments.
  `nodes` - Grid nodes.
Returns:
  Grid future for execution result.

#### callAsync

    public <T,R1,R2> ComputeTaskInternalFuture<R2> callAsync(IgniteClosure<T,R1> job,
                                                    Collection<? extends T> args,
                                                    IgniteReducer<R1,R2> rdc,
                                                    @Nullable
                                                    Collection<ClusterNode> nodes)

Parameters:
  `job` - Job closure.
  `args` - Job arguments.
  `rdc` - Reducer.
  `nodes` - Grid nodes.
Returns:
  Grid future for execution result.

#### runLocalSafe

    public IgniteInternalFuture<?> runLocalSafe(Runnable c)

Executes closure on system pool. Companion to `runLocal(Runnable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
Returns:
  Future.

#### runLocalSafe

    public IgniteInternalFuture<?> runLocalSafe(Runnable c,
                                       boolean sys)

Companion to `runLocal(Runnable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
  `sys` - If `true`, then system pool will be used, otherwise public pool will be used.
Returns:
  Future.

#### runLocalSafe

    public IgniteInternalFuture<?> runLocalSafe(Runnable c,
                                       GridClosurePolicy plc)

Companion to `runLocal(Runnable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
  `plc` - Policy to choose executor pool.
Returns:
  Future.

#### callLocalSafe

    public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c)

Executes closure on system pool. Companion to `callLocal(Callable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
Returns:
  Future.

#### callLocalSafe

    public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c,
                                            boolean sys)

Executes closure on system pool. Companion to `callLocal(Callable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
  `sys` - If `true`, then system pool will be used, otherwise public pool will be used.
Returns:
  Future.

#### callLocalSafe

    public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c,
                                            GridClosurePolicy plc)

Companion to `callLocal(Callable, boolean)` but in case of rejected execution re-runs the closure in the current thread (blocking).

Parameters:
  `c` - Closure to execute.
  `plc` - Policy to choose executor pool.
Returns:
  Future.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0-b1
Release Date | : December 1 2015