Package org.xnio
Class FutureResult<T>
java.lang.Object
org.xnio.FutureResult<T>
- Type Parameters:
T
- theIoFuture
result type
- All Implemented Interfaces:
Result<T>
A result with a corresponding
IoFuture
instance.-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance.FutureResult
(Executor executor) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCancelHandler
(Cancellable cancellable) Add a cancellation handler.Get theIoFuture
for this manager.boolean
Acknowledge the cancellation of this operation.boolean
setException
(IOException exception) Set the exception for this operation.boolean
Set the result for this operation.
-
Constructor Details
-
FutureResult
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 Details
-
getIoFuture
Get theIoFuture
for this manager.- Returns:
- the
IoFuture
-
addCancelHandler
Add a cancellation handler. The argument will be cancelled whenever theIoFuture
is cancelled. If theIoFuture
is already cancelled when this method is called, the handler will be called directly.- Parameters:
cancellable
- the cancel handler
-
setResult
Set the result for this operation. Any threads blocking on this instance will be unblocked. -
setException
Set the exception for this operation. Any threads blocking on this instance will be unblocked.- Specified by:
setException
in interfaceResult<T>
- Parameters:
exception
- the exception to set- Returns:
false
if the operation was already completed,true
otherwise
-
setCancelled
public boolean setCancelled()Acknowledge the cancellation of this operation.- Specified by:
setCancelled
in interfaceResult<T>
- Returns:
false
if the operation was already completed,true
otherwise
-