Package org.springframework.util.concurrent

# Class ListenableFutureTask<T>

java.lang.Object
java.util.concurrent.FutureTask<T>
org.springframework.util.concurrent.ListenableFutureTask<T>

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

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

@Deprecated(since="6.0", forRemoval=true) public class ListenableFutureTask<T> extends FutureTask<T> 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
Extension of `FutureTask` that implements `ListenableFuture`.

Since:
  4.0
Author:
  Arjen Poutsma

## Constructor Summary

Constructors
Constructor
Description
`ListenableFutureTask(Runnable runnable, T result)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `ListenableFutureTask` that will, upon running, execute the given `Runnable`, and arrange that `FutureTask.get()` will return the given result on successful completion.
`ListenableFutureTask(Callable<T> callable)`
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new `ListenableFutureTask` that will, upon running, execute the given `Callable`.

## 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.
`CompletableFuture<T>`
`completable()`
Deprecated, for removal: This API element is subject to removal in a future version.
Expose this `ListenableFuture` as a JDK `CompletableFuture`.
`protected void`
`done()`
Deprecated, for removal: This API element is subject to removal in a future version.

### Methods inherited from class java.util.concurrent.FutureTask

`cancel, get, get, isCancelled, isDone, run, runAndReset, set, setException, toString`

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

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

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

`cancel, get, get, isCancelled, isDone`

## Constructor Details

### ListenableFutureTask

public ListenableFutureTask(Callable<T> callable)
Deprecated, for removal: This API element is subject to removal in a future version.
Create a new `ListenableFutureTask` that will, upon running, execute the given `Callable`.

Parameters:
  `callable` - the callable task

### ListenableFutureTask

public ListenableFutureTask(Runnable runnable, @Nullable T result)
Deprecated, for removal: This API element is subject to removal in a future version.
Create a `ListenableFutureTask` that will, upon running, execute the given `Runnable`, and arrange that `FutureTask.get()` will return the given result on successful completion.

Parameters:
  `runnable` - the runnable task
  `result` - the result to return on successful completion

## 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>`

### done

protected void done()
Deprecated, for removal: This API element is subject to removal in a future version.

Overrides:
  `done` in class `FutureTask<T>`