The Android Developer Challenge is back! Submit your idea before December 2.

CallbackToFutureAdapter.Resolver

public static interface CallbackToFutureAdapter.Resolver

androidx.concurrent.futures.CallbackToFutureAdapter.Resolver<T>


This interface should be implemented by the object passed into CallbackToFutureAdapter.getFuture(Resolver).

Implementations are responsible to resolve passed CallbackToFutureAdapter.Completer object to success or failure inline or in the response to some other callback.

This interface creates a logical scope for the code that resolves a future returned from CallbackToFutureAdapter.getFuture(Resolver) and separates it from outer scope that works with that future as adding listeners etc. This separation allows us to detect situations when the returned future isn't done, but the completer object was garbage collected, and fail the future appropriately instead of keeping the future and its listeners chain forever.

Summary

Public methods

abstract Object attachCompleter(Completer<T> completer)

Create your callback object and start whatever operations are required to trigger it here.

Public methods

attachCompleter

public abstract Object attachCompleter (Completer<T> completer)

Create your callback object and start whatever operations are required to trigger it here.

Parameters
completer Completer: Call one of the set methods on this object to complete the returned Future.

Returns
Object an object to use as the human-readable description of what is expected to complete this future. In error cases, its toString() will be included in the message.

Throws
Exception