Package org.springframework.util.concurrent

# Class CompletableToListenableFutureAdapter<T>

java.lang.Object
org.springframework.util.concurrent.CompletableToListenableFutureAdapter<T>

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

All Implemented Interfaces:
  `Future<T>`, `ListenableFuture<T>`

Direct Known Subclasses:
  `MonoToListenableFutureAdapter`

@Deprecated(since="6.0", forRemoval=true) public class CompletableToListenableFutureAdapter<T> extends Object implements ListenableFuture<T>
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, with no concrete replacement
Adapts a `CompletableFuture` or `CompletionStage` into a Spring `ListenableFuture`.

Since:
  4.2
Author:
  Sebastien Deleuze, Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new adapter for the given `CompletableFuture`.
`CompletableToListenableFutureAdapter(CompletionStage<T> completionStage)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new adapter for the given `CompletionStage`.

## 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.
Register the given `ListenableFutureCallback`.
`void`
`addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)`
Deprecated, for removal: This API element is subject to removal in a future version.
Java 8 lambda-friendly alternative with success and failure callbacks.
`boolean`
`cancel(boolean mayInterruptIfRunning)`
Deprecated, for removal: This API element is subject to removal in a future version.
`CompletableFuture<T>`
`completable()`
Deprecated, for removal: This API element is subject to removal in a future version.
Expose this `ListenableFuture` as a JDK `CompletableFuture`.
`T`
`get()`
Deprecated, for removal: This API element is subject to removal in a future version.
`T`
`get(long timeout, TimeUnit unit)`
Deprecated, for removal: This API element is subject to removal in a future version.
`boolean`
`isCancelled()`
Deprecated, for removal: This API element is subject to removal in a future version.
`boolean`
`isDone()`
Deprecated, for removal: This API element is subject to removal in a future version.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CompletableToListenableFutureAdapter

public CompletableToListenableFutureAdapter(CompletionStage<T> completionStage)
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new adapter for the given `CompletionStage`.

Since:
  4.3.7

### CompletableToListenableFutureAdapter

public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture)
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new adapter for the given `CompletableFuture`.

## Method Details

### addCallback

public void addCallback(ListenableFutureCallback<? super T> callback)
Deprecated, for removal: This API element is subject to removal in a future version.
Description copied from interface: `ListenableFuture`
Register the given `ListenableFutureCallback`.

Specified by:
  `addCallback` in interface `ListenableFuture<T>`
Parameters:
  `callback` - the callback to register

### addCallback

public void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
Deprecated, for removal: This API element is subject to removal in a future version.
Description copied from interface: `ListenableFuture`
Java 8 lambda-friendly alternative with success and failure callbacks.

Specified by:
  `addCallback` in interface `ListenableFuture<T>`
Parameters:
  `successCallback` - the success callback
  `failureCallback` - the failure callback

### completable

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

Specified by:
  `completable` in interface `ListenableFuture<T>`

### cancel

public boolean cancel(boolean mayInterruptIfRunning)
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `cancel` in interface `Future<T>`

### isCancelled

public boolean isCancelled()
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `isCancelled` in interface `Future<T>`

### isDone

public boolean isDone()
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `isDone` in interface `Future<T>`

### get

public T get() throws InterruptedException, ExecutionException
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `get` in interface `Future<T>`
Throws:
  `InterruptedException`
  `ExecutionException`

### get

public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
Deprecated, for removal: This API element is subject to removal in a future version.

Specified by:
  `get` in interface `Future<T>`
Throws:
  `InterruptedException`
  `ExecutionException`
  `TimeoutException`