Interface ListenableFuture<T>
- Type Parameters:
T- the result type returned by this Future'sgetmethod
- All Superinterfaces:
Future<T>
- All Known Implementing Classes:
AsyncResult,CompletableToListenableFutureAdapter,ListenableFutureAdapter,ListenableFutureTask,MonoToListenableFutureAdapter,SettableListenableFuture
Deprecated, for removal: This API element is subject to removal in a future version.
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 TypeMethodDescriptionvoidaddCallback(ListenableFutureCallback<? super T> callback) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, in favor ofCompletableFuture.whenComplete(BiConsumer)voidaddCallback(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 ofCompletableFuture.whenComplete(BiConsumer)default CompletableFuture<T>Deprecated, for removal: This API element is subject to removal in a future version.Expose thisListenableFutureas a JDKCompletableFuture.
-
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 ofCompletableFuture.whenComplete(BiConsumer)Register the givenListenableFutureCallback.- 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 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, for removal: This API element is subject to removal in a future version.Expose thisListenableFutureas a JDKCompletableFuture.- Since:
- 5.0
-
CompletableFuture