public final class

CallbackToFutureAdapter.Completer<T>

extends java.lang.Object

 java.lang.Object

↳androidx.concurrent.futures.CallbackToFutureAdapter.Completer<T>

Overview

Used to complete the future returned by CallbackToFutureAdapter.getFuture(CallbackToFutureAdapter.Resolver)

Summary

Methods
public voidaddCancellationListener(java.lang.Runnable runnable, java.util.concurrent.Executor executor)

Use to propagate cancellation from the future to whatever operation is using this Completer.

protected voidfinalize()

public booleanset(java.lang.Object value)

Sets the result of the Future unless the Future has already been cancelled or set.

public booleansetCancelled()

Cancels Future unless the Future has already been cancelled or set.

public booleansetException(java.lang.Throwable t)

Sets the failed result of the Future unless the Future has already been cancelled or set.

from java.lang.Objectclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public boolean set(java.lang.Object 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: the value to be used as the result

Returns:

true if this attempt completed the Future, false if it was already complete

public boolean setException(java.lang.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: the exception to be used as the failed result

Returns:

true if this attempt completed the Future, false if it was already complete

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:

true if this attempt completed the Future, false if it was already complete

public void addCancellationListener(java.lang.Runnable runnable, java.util.concurrent.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 cancel or this Completer object is garbage collected before the future completes. Not triggered by CallbackToFutureAdapter.Completer.setCancelled().

protected void finalize()