Class MonoToListenableFutureAdapter<T>
- java.lang.Object
- org.springframework.util.concurrent.MonoToListenableFutureAdapter<T>
- Type Parameters:
T
- the object type
- All Implemented Interfaces:
Future<T>
,ListenableFuture<T>
public class MonoToListenableFutureAdapter<T> extends Object implements ListenableFuture<T>
Adapts aMono
into aListenableFuture
.- Since:
- 5.1
- Author:
- Rossen Stoyanchev, Stephane Maldini
Constructor Summary
Constructors Constructor Description MonoToListenableFutureAdapter(reactor.core.publisher.Mono<T> mono)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCallback(ListenableFutureCallback<? super T> callback)
Register the givenListenableFutureCallback
.void
addCallback(SuccessCallback<? super T> success, FailureCallback failure)
Java 8 lambda-friendly alternative with success and failure callbacks.boolean
cancel(boolean mayInterruptIfRunning)
T
get()
T
get(long timeout, TimeUnit unit)
boolean
isCancelled()
boolean
isDone()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.util.concurrent.ListenableFuture
completable
Constructor Detail
MonoToListenableFutureAdapter
public MonoToListenableFutureAdapter(reactor.core.publisher.Mono<T> mono)
Method Detail
cancel
public boolean cancel(boolean mayInterruptIfRunning)
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceFuture<T>
addCallback
public void addCallback(ListenableFutureCallback<? super T> callback)
Description copied from interface:ListenableFuture
Register the givenListenableFutureCallback
.- Specified by:
addCallback
in interfaceListenableFuture<T>
- Parameters:
callback
- the callback to register
addCallback
public void addCallback(SuccessCallback<? super T> success, FailureCallback failure)
Description copied from interface:ListenableFuture
Java 8 lambda-friendly alternative with success and failure callbacks.- Specified by:
addCallback
in interfaceListenableFuture<T>
- Parameters:
success
- the success callbackfailure
- the failure callback