CallbackToFutureAdapter.Resolver


public interface CallbackToFutureAdapter.Resolver<T>


This interface should be implemented by the object passed into getFuture.

Implementations are responsible to resolve passed 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 getFuture 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 @Nullable Object

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

Public methods

attachCompleter

Added in 1.0.0
abstract @Nullable Object attachCompleter(@NonNull CallbackToFutureAdapter.Completer<T> completer)

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

Parameters
@NonNull CallbackToFutureAdapter.Completer<T> completer

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

Returns
@Nullable 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.