org.apache.ignite.internal.util.future

## Class GridEmbeddedFuture<A,B>

- java.lang.Object
- - java.util.concurrent.locks.AbstractOwnableSynchronizer
  - - java.util.concurrent.locks.AbstractQueuedSynchronizer
    - - org.apache.ignite.internal.util.future.GridFutureAdapter<A>
      - - org.apache.ignite.internal.util.future.GridEmbeddedFuture<A,B>

All Implemented Interfaces:
  Serializable, IgniteInternalFuture<A>

Direct Known Subclasses:
  GridDhtEmbeddedFuture

    public class GridEmbeddedFuture<A,B>
    extends GridFutureAdapter<A>

Future which waits for embedded future to complete and then asynchronously executes provided closure with embedded future result.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`AbstractQueuedSynchronizer.ConditionObject`

### Constructor Summary

Constructors
Constructor and Description
`GridEmbeddedFuture(IgniteBiClosure<B,Exception,A> c, IgniteInternalFuture<B> embedded)`
`GridEmbeddedFuture(IgniteInternalFuture<B> embedded, IgniteBiClosure<B,Exception,IgniteInternalFuture<A>> c)` Embeds futures.
`GridEmbeddedFuture(IgniteInternalFuture<B> embedded, IgniteBiClosure<B,Exception,IgniteInternalFuture<A>> c1, IgniteBiClosure<A,Exception,A> c2)` Embeds futures.

### Method Summary

Methods
`boolean` `cancel()` Default no-op implementation that always returns `false`.
`boolean` `isCancelled()` Returns `true` if this computation was cancelled before it completed normally.
`String` `toString()`

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

`chain, duration, endTime, error, get, get, get, get0, ignoreInterrupts, isDone, isFailed, listen, onCancelled, onDone, onDone, onDone, onDone, result, startTime, tryAcquireShared, tryReleaseShared`

### Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer

`acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease`

### Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer

`getExclusiveOwnerThread, setExclusiveOwnerThread`

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

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

### Constructor Detail

#### GridEmbeddedFuture

    public GridEmbeddedFuture(IgniteBiClosure<B,Exception,A> c,
                      IgniteInternalFuture<B> embedded)

Parameters:
  `c` - Closure to execute upon completion of embedded future.
  `embedded` - Embedded future.

#### GridEmbeddedFuture

    public GridEmbeddedFuture(IgniteInternalFuture<B> embedded,
                      IgniteBiClosure<B,Exception,IgniteInternalFuture<A>> c)

Embeds futures. Specific change order of arguments to avoid conflicts.

Parameters:
  `embedded` - Closure.
  `c` - Closure which runs upon completion of embedded closure and which returns another future.

#### GridEmbeddedFuture

    public GridEmbeddedFuture(IgniteInternalFuture<B> embedded,
                      IgniteBiClosure<B,Exception,IgniteInternalFuture<A>> c1,
                      IgniteBiClosure<A,Exception,A> c2)

Embeds futures.

Parameters:
  `embedded` - Future.
  `c1` - Closure which runs upon completion of embedded future and which returns another future.
  `c2` - Closure will runs upon completion of future returned by `c1` closure.

### Method Detail

#### 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<A>`
Overrides:
  `cancel` in class `GridFutureAdapter<A>`
Returns:
  `True` if future was canceled (i.e. was not finished prior to this call).
Throws:
  `IgniteCheckedException` - If cancellation failed.

#### isCancelled

    public boolean isCancelled()

Returns `true` if this computation was cancelled before it completed normally.

Specified by:
  `isCancelled` in interface `IgniteInternalFuture<A>`
Overrides:
  `isCancelled` in class `GridFutureAdapter<A>`
Returns:
  `True` if this computation was cancelled before it completed normally.

#### toString

    public String toString()

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

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.1.0-incubating
Release Date | : May 20 2015