public interface

CallbackToFutureAdapter.Resolver<T>

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

Overview

This interface should be implemented by the object passed into CallbackToFutureAdapter.getFuture(CallbackToFutureAdapter.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(CallbackToFutureAdapter.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

Methods
public java.lang.ObjectattachCompleter(CallbackToFutureAdapter.Completer<java.lang.Object> completer)

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

Methods

public java.lang.Object attachCompleter(CallbackToFutureAdapter.Completer<java.lang.Object> completer)

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

Parameters:

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

Returns:

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.