org.apache.ignite.internal.util.nio

## Interface GridNioFuture<R>

Type Parameters:
  `R` - Type of the result for the future.

All Known Implementing Classes:
  GridNioEmbeddedFuture, GridNioFinishedFuture, GridNioFutureImpl

    public interface GridNioFuture<R>

Reduced variant of `IgniteInternalFuture` interface. Removed asynchronous listen methods which require a valid grid kernal context.

### Method Summary

Methods
`boolean` `cancel()` Cancels this future.
`R` `get()` Synchronously waits for completion of the operation and returns operation result.
`R` `get(long timeout)` Synchronously waits for completion of the operation for up to the timeout specified and returns operation result.
`R` `get(long timeout, TimeUnit unit)` Synchronously waits for completion of the operation for up to the timeout specified and returns operation result.
`boolean` `isCancelled()` Returns `true` if this operation was cancelled before it completed normally.
`boolean` `isDone()` Checks if operation is done.
`void` `listenAsync(IgniteInClosure<? super GridNioFuture<R>> lsnr)` Registers listener closure to be asynchronously notified whenever future completes.
`boolean` `messageThread()`
`void` `messageThread(boolean msgThread)` Sets flag indicating that message send future was created in thread that was processing a message.
`boolean` `skipRecovery()`

### Method Detail

#### get

    R get()
          throws IOException,
                 IgniteCheckedException

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

Returns:
  Operation result.
Throws:
  `IgniteInterruptedCheckedException` - Subclass of `IgniteCheckedException` thrown if the wait was interrupted.
  `IgniteFutureCancelledCheckedException` - Subclass of `IgniteCheckedException` throws if operation was cancelled.
  `IgniteCheckedException` - If operation failed.
  `IOException` - If IOException occurred while performing operation.

#### get

    R get(long timeout)
          throws IOException,
                 IgniteCheckedException

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

Parameters:
  `timeout` - The maximum time to wait in milliseconds.
Returns:
  Operation 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 operation was cancelled.
  `IgniteCheckedException` - If operation failed.
  `IOException` - If IOException occurred while performing operation.

#### get

    R get(long timeout,
        TimeUnit unit)
          throws IOException,
                 IgniteCheckedException

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

Parameters:
  `timeout` - The maximum time to wait.
  `unit` - The time unit of the `timeout` argument.
Returns:
  Operation 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 operation was cancelled.
  `IgniteCheckedException` - If operation failed.
  `IOException` - If IOException occurred while performing operation.

#### cancel

    boolean cancel()
                   throws IgniteCheckedException

Cancels this future.

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

#### isDone

    boolean isDone()

Checks if operation is done.

Returns:
  `True` if operation is done, `false` otherwise.

#### isCancelled

    boolean isCancelled()

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

Returns:
  `True` if this operation was cancelled before it completed normally.

#### listenAsync

    void listenAsync(@Nullable
                   IgniteInClosure<? super GridNioFuture<R>> lsnr)

Registers listener closure to be asynchronously notified whenever future completes.

Parameters:
  `lsnr` - Listener closure to register. If not provided - this method is no-op.

#### messageThread

    void messageThread(boolean msgThread)

Sets flag indicating that message send future was created in thread that was processing a message.

Parameters:
  `msgThread` - `True` if future was created in thread that is processing message.

#### messageThread

    boolean messageThread()

Returns:
  `True` if future was created in thread that was processing message.

#### skipRecovery

    boolean skipRecovery()

Returns:
  `True` if skip recovery for this operation.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC1
Release Date | : February 17 2015