org.apache.ignite.internal.util.future

## Class GridCompoundFuture<T,R>

- java.lang.Object
- - org.apache.ignite.internal.util.future.GridFutureAdapter<R>
  - - org.apache.ignite.internal.util.future.GridCompoundFuture<T,R>

All Implemented Interfaces:
  Serializable, IgniteInternalFuture<R>, IgniteInClosure<IgniteInternalFuture<T>>

Direct Known Subclasses:
  GridCacheCompoundFuture, GridCompoundIdentityFuture, GridDhtForceKeysFuture

    public class GridCompoundFuture<T,R>
    extends GridFutureAdapter<R>
    implements IgniteInClosure<IgniteInternalFuture<T>>

Future composed of multiple inner futures.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridCompoundFuture()` Default constructor.
`GridCompoundFuture(IgniteReducer<T,R> rdc)`

### Method Summary

Methods
`void` `add(IgniteInternalFuture<T> fut)` Adds a future to this compound future.
`void` `apply(IgniteInternalFuture<T> fut)` Closure body.
`boolean` `cancel()` Default no-op implementation that always returns `false`.
`protected void` `clear()` Clear futures.
`protected IgniteInternalFuture<T>` `future(int idx)` Returns future at the specified position in this list.
`Collection<IgniteInternalFuture<T>>` `futures()` Gets collection of futures.
`protected int` `futuresCountNoLock()`
`protected boolean` `hasFutures()`
`protected boolean` `hasPending()` Checks if there are pending futures.
`protected boolean` `ignoreFailure(Throwable err)` Checks if this compound future should ignore this particular exception.
`boolean` `initialized()`
`void` `markInitialized()` Mark this future as initialized.
`String` `toString()`

### Methods inherited from class org.apache.ignite.internal.util.future.GridFutureAdapter

`chain, chain, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, onDone, onDone, result`

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

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

### Constructor Detail

#### GridCompoundFuture

    public GridCompoundFuture()

Default constructor.

#### GridCompoundFuture

    public GridCompoundFuture(@Nullable
                      IgniteReducer<T,R> rdc)

Parameters:
  `rdc` - Reducer.

### Method Detail

#### apply

    public final void apply(IgniteInternalFuture<T> fut)

Closure body.

Specified by:
  `apply` in interface `IgniteInClosure<IgniteInternalFuture<T>>`
Parameters:
  `fut` - Closure argument.

#### cancel

    public boolean cancel()
                   throws IgniteCheckedException

Default no-op implementation that always returns `false`. Futures that do support cancellation should override this method and call `GridFutureAdapter.onCancelled()` callback explicitly if cancellation indeed did happen.

Specified by:
  `cancel` in interface `IgniteInternalFuture<R>`
Overrides:
  `cancel` in class `GridFutureAdapter<R>`
Returns:
  `True` if future was canceled (i.e. was not finished prior to this call).
Throws:
  `IgniteCheckedException` - If cancellation failed.

#### futures

    public final Collection<IgniteInternalFuture<T>> futures()

Gets collection of futures.

Returns:
  Collection of futures.

#### ignoreFailure

    protected boolean ignoreFailure(Throwable err)

Checks if this compound future should ignore this particular exception.

Parameters:
  `err` - Exception to check.
Returns:
  `True` if this error should be ignored.

#### hasPending

    protected final boolean hasPending()

Checks if there are pending futures. This is not the same as `GridFutureAdapter.isDone()` because child classes may override `GridFutureAdapter.onDone(Object, Throwable)` call and delay completion.

Returns:
  `True` if there are pending futures.

#### add

    public final void add(IgniteInternalFuture<T> fut)

Adds a future to this compound future.

Parameters:
  `fut` - Future to add.

#### clear

    protected final void clear()

Clear futures.

#### initialized

    public final boolean initialized()

Returns:
  `True` if this future was initialized. Initialization happens when `markInitialized()` method is called on future.

#### markInitialized

    public final void markInitialized()

Mark this future as initialized.

#### future

    protected final IgniteInternalFuture<T> future(int idx)

Returns future at the specified position in this list.

Parameters:
  `idx` - - index index of the element to return
Returns:
  Future.

#### futuresCountNoLock

    protected final int futuresCountNoLock()

Returns:
  Futures size.

#### hasFutures

    protected final boolean hasFutures()

Returns:
  `True` if has at least one future.

#### toString

    public String toString()

Overrides:
  `toString` in class `GridFutureAdapter<R>`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.2.0
Release Date | : September 15 2017