asDeferred

Returns a Deferred that is completed or failed by thisListenableFuture.

Completion is non-atomic between the two promises.

Cancellation is propagated bidirectionally.

When thisListenableFuture completes (either successfully or exceptionally) it will try to complete the returned Deferred with the same value or exception. This will succeed, barring a race with cancellation of the Deferred.

When thisListenableFuture is successfully cancelled, it will cancel the returned Deferred.

When the returned Deferred is cancelled, it will try to propagate the cancellation to thisListenableFuture. Propagation will succeed, barring a race with the ListenableFuture completing normally. This is the only case in which the returned Deferred will complete with a different outcome than thisListenableFuture.