org.apache.ignite.internal.util.distributed

## Class DistributedProcess<I extends Serializable,R extends Serializable>

- java.lang.Object
- - org.apache.ignite.internal.util.distributed.DistributedProcess<I,R>

Type Parameters:
  `I` - Request type.
  `R` - Result type.

    public class DistributedProcess<I extends Serializable,R extends Serializable>
    extends Object

Distributed process is a cluster-wide process that accumulates single nodes results to finish itself.

The process consists of the following phases:

1. The initial request starts the process. The `InitMessage` sent via discovery.
2. Each server node processes an initial request and sends the single node result to the coordinator. The `SingleNodeMessage` sent via communication.
3. The coordinator accumulate all single nodes results and finish process. The `FullMessage` sent via discovery.

Several processes of one type can be started at the same time.

See Also:
  `InitMessage`, `FullMessage`

### Nested Class Summary

Nested Classes
`static class` `DistributedProcess.DistributedProcessType` Defines distributed processes.

### Constructor Summary

Constructors
Constructor and Description
`DistributedProcess(GridKernalContext ctx, DistributedProcess.DistributedProcessType type, Function<I,IgniteInternalFuture<R>> exec, CI3<UUID,Map<UUID,R>,Map<UUID,Exception>> finish)`
`DistributedProcess(GridKernalContext ctx, DistributedProcess.DistributedProcessType type, Function<I,IgniteInternalFuture<R>> exec, CI3<UUID,Map<UUID,R>,Map<UUID,Exception>> finish, BiFunction<UUID,I,? extends InitMessage<I>> initMsgFactory)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `start(UUID id, I req)` Starts distributed process.

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

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

### Constructor Detail

#### DistributedProcess

    public DistributedProcess(GridKernalContext ctx,
                              DistributedProcess.DistributedProcessType type,
                              Function<I,IgniteInternalFuture<R>> exec,
                              CI3<UUID,Map<UUID,R>,Map<UUID,Exception>> finish)

Parameters:
  `ctx` - Kernal context.
  `type` - Process type.
  `exec` - Execute action and returns future with the single node result to send to the coordinator.
  `finish` - Finish process closure. Called on each node when all single nodes results received.

#### DistributedProcess

    public DistributedProcess(GridKernalContext ctx,
                              DistributedProcess.DistributedProcessType type,
                              Function<I,IgniteInternalFuture<R>> exec,
                              CI3<UUID,Map<UUID,R>,Map<UUID,Exception>> finish,
                              BiFunction<UUID,I,? extends InitMessage<I>> initMsgFactory)

Parameters:
  `ctx` - Kernal context.
  `type` - Process type.
  `exec` - Execute action and returns future with the single node result to send to the coordinator.
  `finish` - Finish process closure. Called on each node when all single nodes results received.
  `initMsgFactory` - Factory which creates custom `InitMessage` for distributed process initialization.

### Method Detail

#### start

    public void start(UUID id,
                      I req)

Starts distributed process.

Parameters:
  `id` - Process id.
  `req` - Initial request.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020