Package org.springframework.util.concurrent

# Interface ListenableFuture<T>

Type Parameters:
  `T` - the result type returned by this Future's `get` method

All Superinterfaces:
  `Future<T>`

All Known Implementing Classes:
  `CompletableToListenableFutureAdapter`, `ListenableFutureAdapter`, `ListenableFutureTask`, `MonoToListenableFutureAdapter`, `SettableListenableFuture`

@Deprecated(since="6.0", forRemoval=true) public interface ListenableFuture<T> extends Future<T>
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `CompletableFuture`
Extend `Future` with the capability to accept completion callbacks. If the future has completed when the callback is added, the callback is triggered immediately.

Inspired by `com.google.common.util.concurrent.ListenableFuture`.

Since:
  4.0
Author:
  Arjen Poutsma, Sebastien Deleuze, Juergen Hoeller

## Method Summary

Modifier and Type
Method
Description
`void`
`addCallback(ListenableFutureCallback<? super T> callback)`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
`void`
`addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
`default CompletableFuture<T>`
`completable()`
Deprecated, for removal: This API element is subject to removal in a future version.
Expose this `ListenableFuture` as a JDK `CompletableFuture`.

### Methods inherited from interface java.util.concurrent.Future

`cancel, get, get, isCancelled, isDone`

## Method Details

### addCallback

@Deprecated(since="6.0", forRemoval=true) void addCallback(ListenableFutureCallback<? super T> callback)
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
Register the given `ListenableFutureCallback`.

Parameters:
  `callback` - the callback to register

### addCallback

@Deprecated(since="6.0", forRemoval=true) void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `CompletableFuture.whenComplete(BiConsumer)`
Java 8 lambda-friendly alternative with success and failure callbacks.

Parameters:
  `successCallback` - the success callback
  `failureCallback` - the failure callback
Since:
  4.1

### completable

default CompletableFuture<T> completable()
Deprecated, for removal: This API element is subject to removal in a future version.
Expose this `ListenableFuture` as a JDK `CompletableFuture`.

Since:
  5.0