asDeferred

Returns a Deferred that is completed or failed by this ListenableFuture.

Completion is non-atomic between the two promises.

Cancellation is propagated bidirectionally.

When this ListenableFuture 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 this ListenableFuture is successfully cancelled, it will cancel the returned Deferred.

When the returned Deferred is cancelled, it will try to propagate the cancellation to this ListenableFuture. 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 this ListenableFuture.