Top Description Fields Constructors Methods
org.xnio

public Class FutureResult<T>

extends Object
implements Result<T>
Class Inheritance
All Implemented Interfaces
org.xnio.Result
Type Parameters
<T>
the IoFuture result type
Imports
java.util.concurrent.Executor, java.io.IOException

A result with a corresponding org.xnio.IoFuture instance.

Field Summary

Modifier and TypeField and Description
private final AbstractIoFuture<T>

Constructor Summary

AccessConstructor and Description
public
FutureResult(final Executor
the executor to use to execute listener notifiers.
executor
)

Construct a new instance.

public
FutureResult()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
addCancelHandler(final Cancellable
the cancel handler
cancellable
)

Add a cancellation handler.

public IoFuture<T>

Returns:

the IoFuture
getIoFuture
()

Get the IoFuture for this manager.

public boolean

Returns:

false if the operation was already completed, true otherwise
setCancelled
()

Implements org.xnio.Result.setCancelled.

Acknowledge the cancellation of this operation.

public boolean

Returns:

false if the operation was already completed, true otherwise
setException
(final IOException
the exception to set
exception
)

Implements org.xnio.Result.setException.

Set the exception for this operation.

public boolean

Returns:

false if the operation was already completed, true otherwise
setResult
(final T
the result to set
result
)

Implements org.xnio.Result.setResult.

Set the result for this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ioFutureback to summary
private final AbstractIoFuture<T> ioFuture

Constructor Detail

FutureResultback to summary
public FutureResult(final Executor executor)

Construct a new instance.

Parameters
executor:Executor

the executor to use to execute listener notifiers.

FutureResultback to summary
public FutureResult()

Construct a new instance. The direct executor will be used to execute handler notifiers.

Method Detail

addCancelHandlerback to summary
public void addCancelHandler(final Cancellable cancellable)

Add a cancellation handler. The argument will be cancelled whenever the IoFuture is cancelled. If the IoFuture is already cancelled when this method is called, the handler will be called directly.

Parameters
cancellable:Cancellable

the cancel handler

getIoFutureback to summary
public IoFuture<T> getIoFuture()

Get the IoFuture for this manager.

Returns:IoFuture<T>

the IoFuture

setCancelledback to summary
public boolean setCancelled()

Implements org.xnio.Result.setCancelled.

Acknowledge the cancellation of this operation.

Returns:boolean

false if the operation was already completed, true otherwise

setExceptionback to summary
public boolean setException(final IOException exception)

Implements org.xnio.Result.setException.

Set the exception for this operation. Any threads blocking on this instance will be unblocked.

Parameters
exception:IOException

the exception to set

Returns:boolean

false if the operation was already completed, true otherwise

setResultback to summary
public boolean setResult(final T result)

Implements org.xnio.Result.setResult.

Set the result for this operation. Any threads blocking on this instance will be unblocked.

Parameters
result:T

the result to set

Returns:boolean

false if the operation was already completed, true otherwise