org.apache.ignite.internal.processors.platform.compute

## Class PlatformCompute.ComputeConvertingFuture

- java.lang.Object
- - org.apache.ignite.internal.processors.platform.compute.PlatformCompute.ComputeConvertingFuture

All Implemented Interfaces:
  IgniteInternalFuture

Enclosing class:
  PlatformCompute

    protected class PlatformCompute.ComputeConvertingFuture
    extends Object
    implements IgniteInternalFuture

Wraps ComputeTaskFuture as IgniteInternalFuture.

### Constructor Summary

Constructors
Constructor and Description
`PlatformCompute.ComputeConvertingFuture(ComputeTaskFuture fut)` Ctor.

### Method Summary

Methods
`boolean` `cancel()` Cancels this future.
`IgniteInternalFuture` `chain(IgniteClosure doneCb)` Make a chained future to convert result of this future (when complete) into a new format.
`protected Object` `convertResult(Object obj)` Converts future result.
`long` `duration()` Gets duration in milliseconds between start of the future and current time if future is not finished, or between start and finish of this future.
`Throwable` `error()`
`Object` `get()` Synchronously waits for completion of the computation and returns computation result.
`Object` `get(long timeout)` Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.
`Object` `get(long timeout, TimeUnit unit)` Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.
`Object` `getUninterruptibly()` Synchronously waits for completion of the computation and returns computation result ignoring interrupts.
`boolean` `isCancelled()` Returns `true` if this computation was cancelled before it completed normally.
`boolean` `isDone()` Checks if computation is done.
`void` `listen(IgniteInClosure lsnr)` Registers listener closure to be asynchronously notified whenever future completes.
`Object` `result()`
`long` `startTime()` Gets start time for this future.

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

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

### Constructor Detail

#### PlatformCompute.ComputeConvertingFuture

    public PlatformCompute.ComputeConvertingFuture(ComputeTaskFuture fut)

Ctor.

Parameters:
  `fut` - Future to wrap.

### Method Detail

#### get

    public Object get()
               throws IgniteCheckedException

Synchronously waits for completion of the computation and returns computation result.

Specified by:
  `get` in interface `IgniteInternalFuture`
Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### get

    public Object get(long timeout)
               throws IgniteCheckedException

Synchronously waits for completion of the computation for up to the timeout specified and returns computation result. This method is equivalent to calling `get(long, TimeUnit.MILLISECONDS)`.

Specified by:
  `get` in interface `IgniteInternalFuture`
Parameters:
  `timeout` - The maximum time to wait in milliseconds.
Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureTimeoutCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was timed out.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### get

    public Object get(long timeout,
             TimeUnit unit)
               throws IgniteCheckedException

Synchronously waits for completion of the computation for up to the timeout specified and returns computation result.

Specified by:
  `get` in interface `IgniteInternalFuture`
Parameters:
  `timeout` - The maximum time to wait.
  `unit` - The time unit of the `timeout` argument.
Returns:
  Computation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureTimeoutCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was timed out.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### getUninterruptibly

    public Object getUninterruptibly()
                              throws IgniteCheckedException

Synchronously waits for completion of the computation and returns computation result ignoring interrupts.

Specified by:
  `getUninterruptibly` in interface `IgniteInternalFuture`
Returns:
  Computation result.
Throws:
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if computation was cancelled.
  `IgniteCheckedException` - If computation failed.

#### cancel

    public boolean cancel()
                   throws IgniteCheckedException

Cancels this future.

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

#### isDone

    public boolean isDone()

Checks if computation is done.

Specified by:
  `isDone` in interface `IgniteInternalFuture`
Returns:
  `True` if computation is done, `false` otherwise.

#### isCancelled

    public boolean isCancelled()

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

Specified by:
  `isCancelled` in interface `IgniteInternalFuture`
Returns:
  `True` if this computation was cancelled before it completed normally.

#### startTime

    public long startTime()

Gets start time for this future.

Specified by:
  `startTime` in interface `IgniteInternalFuture`
Returns:
  Start time for this future.

#### duration

    public long duration()

Gets duration in milliseconds between start of the future and current time if future is not finished, or between start and finish of this future.

Specified by:
  `duration` in interface `IgniteInternalFuture`
Returns:
  Time in milliseconds this future has taken to execute.

#### listen

    public void listen(IgniteInClosure lsnr)

Registers listener closure to be asynchronously notified whenever future completes.

Specified by:
  `listen` in interface `IgniteInternalFuture`
Parameters:
  `lsnr` - Listener closure to register. If not provided - this method is no-op.

#### chain

    public IgniteInternalFuture chain(IgniteClosure doneCb)

Make a chained future to convert result of this future (when complete) into a new format. It is guaranteed that done callback will be called only ONCE.

Specified by:
  `chain` in interface `IgniteInternalFuture`
Parameters:
  `doneCb` - Done callback that is applied to this future when it finishes to produce chained future result.
Returns:
  Chained future that finishes after this future completes and done callback is called.

#### error

    public Throwable error()

Specified by:
  `error` in interface `IgniteInternalFuture`
Returns:
  Error value if future has already been completed with error.

#### result

    public Object result()

Specified by:
  `result` in interface `IgniteInternalFuture`
Returns:
  Result value if future has already been completed normally.

#### convertResult

    protected Object convertResult(Object obj)

Converts future result.

Parameters:
  `obj` - Object to convert.
Returns:
  Result.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.6.0
Release Date | : May 18 2016