CallbackToFutureAdapter.Completer
public
static
final
class
CallbackToFutureAdapter.Completer
extends Object
java.lang.Object | |
↳ | androidx.concurrent.futures.CallbackToFutureAdapter.Completer<T> |
Used to complete the future returned by CallbackToFutureAdapter.getFuture(CallbackToFutureAdapter.Resolver
Summary
Public methods | |
---|---|
void
|
addCancellationListener(Runnable runnable, Executor executor)
Use to propagate cancellation from the future to whatever operation is using this Completer. |
boolean
|
set(T value)
Sets the result of the |
boolean
|
setCancelled()
Cancels |
boolean
|
setException(Throwable t)
Sets the failed result of the |
Protected methods | |
---|---|
void
|
finalize()
|
Inherited methods | |
---|---|
Public methods
addCancellationListener
public void addCancellationListener (Runnable runnable, Executor executor)
Use to propagate cancellation from the future to whatever operation is using this Completer.
Will be called when the returned Future is cancelled by
Future.cancel(boolean)
or this Completer
object is garbage collected
before the future completes.
Not triggered by setCancelled()
.
Parameters | |
---|---|
runnable |
Runnable |
executor |
Executor |
set
public boolean set (T value)
Sets the result of the Future
unless the Future
has already been
cancelled or
set. When a call to this method returns, the Future
is guaranteed to be done.
Parameters | |
---|---|
value |
T : the value to be used as the result |
Returns | |
---|---|
boolean |
true if this attempt completed the Future , false if it was already
complete
|
setCancelled
public boolean setCancelled ()
Cancels Future
unless the Future
has already been cancelled or set.
When a
call to this method returns, the Future
is guaranteed to be done.
Returns | |
---|---|
boolean |
true if this attempt completed the Future , false if it was already
complete
|
setException
public boolean setException (Throwable t)
Sets the failed result of the Future
unless the Future
has already been
cancelled or set. When a call to this method returns, the Future
is guaranteed
to be
done.
Parameters | |
---|---|
t |
Throwable : the exception to be used as the failed result |
Returns | |
---|---|
boolean |
true if this attempt completed the Future , false if it was already
complete
|
Protected methods
finalize
protected void finalize ()