- 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 void
addCancelHandler(Cancellable cancellable)
Add a cancellation handler.IoFuture<T>
getIoFuture()
Get theIoFuture
for this manager.boolean
setCancelled()
Acknowledge the cancellation of this operation.boolean
setException(java.io.IOException exception)
Set the exception for this operation.boolean
setResult(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 theIoFuture
for this manager.- Returns:
- the
IoFuture
-
addCancelHandler
public void addCancelHandler(Cancellable cancellable)
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
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:
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
-
-