T - the type of output of a successful processpublic interface Settable<T>
Promise, where SettablePartial is a special case
that can also accept an unchecked Exception.| Modifier and Type | Method and Description |
|---|---|
boolean |
isSet()
Returns
true if this Settable has been set to a value or error. |
boolean |
onCancelled(Runnable r)
Register code to be called if this operation is cancelled.
|
void |
onCancelledCancel(Cancellable c)
Link an operation to cancel in the event that this
Settable is cancelled. |
void |
set(T value)
Set this
Settable to a value. |
void |
setError(Error error)
Set this
Settable to an error. |
void |
setError(RuntimeException error)
Set this
Settable to an error. |
void set(T value)
Settable to a value. This will invoke callbacks, and unblock
all Threads waiting on associated Futures. A Settable
can be set only once and this call
will throw an exception if this object is already set to a value or error. It
is not, however, an error to call this if the operation has been cancelled.
If the task has been cancelled, this call will have no effect.value - the output of this successful processIllegalStateException - if set() or setError() has
already been called.void setError(RuntimeException error)
Settable to an error. This call will invoke callbacks, and unblock
all Threads waiting on associated Futures. A Settable
can be set only once and this call will
throw an exception if this object is already set to a value or error. It
is not, however, an error to call this method if the operation has been cancelled.
If the task has been cancelled, this call will have no effect.error - the error encountered in the course of this processIllegalStateException - if set() or setError() has
already been called.void setError(Error error)
Settable to an error. This call will invoke callbacks, and unblock
all Threads waiting on associated Futures. A Settable
can be set only once and this call will
throw an exception if this object is already set to a value or error. It
is not, however, an error to call this method if the operation has been cancelled.
If the task has been cancelled, this call will have no effect.error - the error encountered in the course of this processIllegalStateException - if set() or setError() has
already been called.boolean isSet()
true if this Settable has been set to a value or error.true if a value or error has been set, false otherwiseboolean onCancelled(Runnable r)
Settables can
be cancelled by calls to PartialFuture.cancel() on associated Futures.
If this Settable is already set, the
callback will not be registered and this call will return false. If this
call returns true the registered callback is guaranteed to be called if
the associated Future is cancelled.r - routine to execute if cancelled.true if the callback was registered, false otherwise.void onCancelledCancel(Cancellable c)
Settable is cancelled.
This is a convenience method (for more complicated calls to
onCancelled(Runnable)) with possible internal optimizations.c - the operation to cancel