- java.lang.Object
-
- org.xnio.FutureResult<T>
-
-
Constructor Summary
Constructors Constructor Description FutureResult()Construct a new instance.FutureResult(java.util.concurrent.Executor executor)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCancelHandler(Cancellable cancellable)Add a cancellation handler.IoFuture<T>getIoFuture()Get theIoFuturefor this manager.booleansetCancelled()Acknowledge the cancellation of this operation.booleansetException(java.io.IOException exception)Set the exception for this operation.booleansetResult(T result)Set the result for this operation.
-
-
-
Constructor Detail
-
FutureResult
public FutureResult(java.util.concurrent.Executor executor)
Construct a new instance.- Parameters:
executor- the executor to use to execute listener notifiers.
-
FutureResult
public FutureResult()
Construct a new instance. The direct executor will be used to execute handler notifiers.
-
-
Method Detail
-
getIoFuture
public IoFuture<T> getIoFuture()
Get theIoFuturefor this manager.- Returns:
- the
IoFuture
-
addCancelHandler
public void addCancelHandler(Cancellable cancellable)
Add a cancellation handler. The argument will be cancelled whenever theIoFutureis cancelled. If theIoFutureis already cancelled when this method is called, the handler will be called directly.- Parameters:
cancellable- the cancel handler
-
setResult
public boolean setResult(T result)
Set the result for this operation. Any threads blocking on this instance will be unblocked.
-
setException
public boolean setException(java.io.IOException exception)
Set the exception for this operation. Any threads blocking on this instance will be unblocked.- Specified by:
setExceptionin interfaceResult<T>- Parameters:
exception- the exception to set- Returns:
falseif the operation was already completed,trueotherwise
-
setCancelled
public boolean setCancelled()
Acknowledge the cancellation of this operation.- Specified by:
setCancelledin interfaceResult<T>- Returns:
falseif the operation was already completed,trueotherwise
-
-