broadcast(...) methods broadcast jobs to all nodes in the cluster group.

affinityCall(...) and affinityRun(...) methods collocate jobs with nodes
on which a specified key is cached.

Note that if attempt is made to execute a computation over an empty cluster group (i.e. cluster group
that does not have any alive nodes), then ClusterGroupEmptyException
will be thrown out of result future.

Load Balancing

In all cases other than broadcast(...), Ignite must select a node for a computation
to be executed. The node will be selected based on the underlying LoadBalancingSpi,
which by default sequentially picks next available node from the underlying cluster group. Other
load balancing policies, such as random or adaptive, can be configured as well by
selecting a different load balancing SPI in Ignite configuration. If your logic requires some custom
load balancing behavior, consider implementing ComputeTask directly.

Fault Tolerance

Ignite guarantees that as long as there is at least one grid node standing, every job will be
executed. Jobs will automatically failover to another node if a remote node crashed
or has rejected execution due to lack of resources. By default, in case of failover, next
load balanced node will be picked for job execution. Also jobs will never be re-routed to the
nodes they have failed on. This behavior can be changed by configuring any of the existing or a custom
FailoverSpi in grid configuration.

Resource Injection

All compute jobs, including closures, runnables, callables, and tasks can be injected with
ignite resources. Both, field and method based injections are supported. The following grid
resources can be injected:

Computation SPIs

Note that regardless of which method is used for executing computations, all relevant SPI implementations
configured for this compute instance will be used (i.e. failover, load balancing, collision resolution,
checkpoints, etc.). If you need to override configured defaults, you should use compute task together with
ComputeTaskSpis annotation. Refer to ComputeTask documentation for more information.

Executes given job on the node where partition is located (the partition is primary on the node)
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
The data of the partition will not be migrated from the target node
while the job is executed.

Executes given job on the node where partition is located (the partition is primary on the node)
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
The data of the partition will not be migrated from the target node
while the job is executed.

affinityRun

Executes given job on the node where data for provided affinity key is located
(a.k.a. affinity co-location).
It's guaranteed that the data of the whole partition, the affinity key belongs to,
will present on the destination node throughout the job execution.

Parameters:

cacheName - Name of the cache to use for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityRunAsync

Executes given job asynchronously on the node where data for provided affinity key is located
(a.k.a. affinity co-location). The data of the partition where affKey is stored
will not be migrated from the target node while the job is executed.

Parameters:

cacheName - Name of the cache to use for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityRun

Executes given job on the node where data for provided affinity key is located
(a.k.a. affinity co-location).
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache is used for
affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityRunAsync

Executes given job asynchronously on the node where data for provided affinity key is located
(a.k.a. affinity co-location). The data of the partition where affKey is stored
will not be migrated from the target node while the job is executed. The data
of the extra caches' partitions with the same partition number also will not be migrated.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityRun

Executes given job on the node where partition is located (the partition is primary on the node)
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache is used for
affinity co-location.

partId - Partition number.

job - Job which will be co-located on the node with given affinity key.

affinityRunAsync

Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
The data of the partition will not be migrated from the target node
while the job is executed. The data of the extra caches' partitions with the same partition number
also will not be migrated.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

partId - Partition number.

job - Job which will be co-located on the node with given affinity key.

affinityCall

Executes given job on the node where data for provided affinity key is located
(a.k.a. affinity co-location).
It's guaranteed that the data of the whole partition, the affinity key belongs to,
will present on the destination node throughout the job execution.

Parameters:

cacheName - Name of the cache to use for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityCallAsync

Executes given job asynchronously on the node where data for provided affinity key is located
(a.k.a. affinity co-location). The data of the partition where affKey is stored
will not be migrated from the target node while the job is executed.

Parameters:

cacheName - Name of the cache to use for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityCall

Executes given job on the node where data for provided affinity key is located
(a.k.a. affinity co-location).
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityCallAsync

Executes given job asynchronously on the node where data for provided affinity key is located
(a.k.a. affinity co-location). The data of the partition where affKey is stored
will not be migrated from the target node while the job is executed. The data
of the extra caches' partitions with the same partition number also will not be migrated.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

affKey - Affinity key.

job - Job which will be co-located on the node with given affinity key.

affinityCall

Executes given job on the node where partition is located (the partition is primary on the node)
It's guaranteed that the data of all the partitions of all participating caches,
the affinity key belongs to, will present on the destination node throughout the job execution.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

partId - Partition to reserve.

job - Job which will be co-located on the node with given affinity key.

affinityCallAsync

Executes given job asynchronously on the node where partition is located (the partition is primary on the node)
The data of the partition will not be migrated from the target node
while the job is executed. The data of the extra caches' partitions with the same partition number
also will not be migrated.

Parameters:

cacheNames - Names of the caches to to reserve the partition. The first cache uses for affinity co-location.

partId - Partition to reserve.

job - Job which will be co-located on the node with given affinity key.

broadcast

Broadcasts given closure job with passed in argument to all nodes in the cluster group.
Every participating node will return a job result. Collection of all returned job results
is returned from the result future.

broadcastAsync

Broadcasts given closure job asynchronously with passed in argument to all nodes in the cluster group.
Every participating node will return a job result. Collection of all returned job results
is returned from the result future.

Parameters:

job - Job to broadcast to all cluster group nodes.

arg - Job closure argument.

Returns:

a Future representing pending completion of the broadcast execution of the job.

apply

Executes provided closure job on a node within the underlying cluster group. This method is different
from run(...) and call(...) methods in a way that it receives job argument
which is then passed into the closure at execution time.

applyAsync

Executes provided closure job asynchronously on a node within the underlying cluster group.
This method is different from run(...) and call(...) methods in a way that
it receives job argument which is then passed into the closure at execution time.

apply

Executes provided closure job on nodes within the underlying cluster group. A new job is executed for
every argument in the passed in collection. The number of actual job executions will be
equal to size of the job arguments collection.

applyAsync

Executes provided closure job asynchronously on nodes within the underlying cluster group. A new job is executed
for every argument in the passed in collection. The number of actual job executions will be
equal to size of the job arguments collection.

apply

Executes provided closure job on nodes within the underlying cluster group. A new job is executed for
every argument in the passed in collection. The number of actual job executions will be
equal to size of the job arguments collection. The returned job results will be reduced
into an individual result by provided reducer.

Parameters:

job - Job to run.

args - Job arguments.

rdc - Reducer to reduce all job results into one individual return value.

applyAsync

Executes provided closure job asynchronously on nodes within the underlying cluster group. A new job is executed
for every argument in the passed in collection. The number of actual job executions will be
equal to size of the job arguments collection. The returned job results will be reduced
into an individual result by provided reducer.

Parameters:

job - Job to run.

args - Job arguments.

rdc - Reducer to reduce all job results into one individual return value.

withName

Sets task name for the next executed task in the current thread.
When task starts execution, the name is reset, so one name is used only once. You may use
this method to set task name when executing jobs directly, without explicitly
defining ComputeTask.

Here is an example.

ignite.withName("MyTask").run(new IgniteRunnable() {...});

Parameters:

taskName - Task name.

Returns:

This IgniteCompute instance for chaining calls.

withTimeout

Sets task timeout for the next executed task in the current thread.
When task starts execution, the timeout is reset, so one timeout is used only once. You may use
this method to set task name when executing jobs directly, without explicitly
defining ComputeTask.

Here is an example.

ignite.withTimeout(10000).run(new IgniteRunnable() {...});

Parameters:

timeout - Computation timeout in milliseconds.

Returns:

This IgniteCompute instance for chaining calls.

withNoFailover

Sets no-failover flag for the next task executed in the current thread.
If flag is set, job will be never failed over even if remote node crashes or rejects execution.
When task starts execution, the no-failover flag is reset, so all other task will use default
failover policy, unless this flag is set again.

Here is an example.

ignite.compute().withNoFailover().run(new IgniteRunnable() {...});

Returns:

This IgniteCompute instance for chaining calls.

localDeployTask

Explicitly deploys a task with given class loader on the local node. Upon completion of this method,
a task can immediately be executed on the grid, considering that all participating
remote nodes also have this task deployed.

Note that tasks are automatically deployed upon first execution (if peer-class-loading is enabled),
so use this method only when the provided class loader is different from the
taskClass.getClassLoader().

Another way of class deployment is deployment from local class path.
Classes from local class path always have a priority over P2P deployed ones.

Note that class can be deployed multiple times on remote nodes, i.e. re-deployed. Ignition
maintains internal version of deployment for each instance of deployment (analogous to
class and class loader in Java). Execution happens always on the latest deployed instance.

This method has no effect if the class passed in was already deployed.

Parameters:

taskCls - Task class to deploy. If task class has ComputeTaskName annotation,
then task will be deployed under the name specified within annotation. Otherwise, full
class name will be used as task's name.

clsLdr - Task class loader. This class loader is in charge
of loading all necessary resources for task execution.

undeployTask

Makes the best attempt to undeploy a task with given name within the underlying cluster group.
Note that this method returns immediately and does not wait until the task will actually be
undeployed on every node.

withExecutor

Gets instance of the compute API associated with custom executor. All tasks and closures submitted to returned
instance will be processed by this executor on both remote and local nodes. If executor with the given name
doesn't exist, task will be processed in default ("public") pool.