Interface ListenableFuture<T>
- Type Parameters:
T
- the result type returned by this Future'sget
method
- All Superinterfaces:
Future<T>
- All Known Implementing Classes:
AsyncResult
,CompletableToListenableFutureAdapter
,ListenableFutureAdapter
,ListenableFutureTask
,MonoToListenableFutureAdapter
,SettableListenableFuture
Deprecated.
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 TypeMethodDescriptionvoid
addCallback
(ListenableFutureCallback<? super T> callback) Deprecated.as of 6.0, in favor ofCompletableFuture.whenComplete(BiConsumer)
void
addCallback
(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) Deprecated.as of 6.0, in favor ofCompletableFuture.whenComplete(BiConsumer)
default CompletableFuture<T>
Deprecated.Expose thisListenableFuture
as a JDKCompletableFuture
.
-
Method Details
-
addCallback
Deprecated.as of 6.0, in favor ofCompletableFuture.whenComplete(BiConsumer)
Register the givenListenableFutureCallback
.- Parameters:
callback
- the callback to register
-
addCallback
@Deprecated(since="6.0") void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) Deprecated.as of 6.0, in favor ofCompletableFuture.whenComplete(BiConsumer)
Java 8 lambda-friendly alternative with success and failure callbacks.- Parameters:
successCallback
- the success callbackfailureCallback
- the failure callback- Since:
- 4.1
-
completable
Deprecated.Expose thisListenableFuture
as a JDKCompletableFuture
.- Since:
- 5.0
-
CompletableFuture