CallbackToFutureAdapter.Resolver

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 functions

Any?

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

Public functions

attachCompleter

Added in 1.0.0
fun attachCompleter(completer: CallbackToFutureAdapter.Completer<T!>): Any?

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

Parameters
completer: CallbackToFutureAdapter.Completer<T!>

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

Returns
Any?

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.