org.springframework.messaging.support

Class MonoToListenableFutureAdapter<T>

  • java.lang.Object
    • org.springframework.messaging.support.MonoToListenableFutureAdapter<T>
  • Type Parameters:
    T - the object type
    All Implemented Interfaces:
    java.util.concurrent.Future<T>, ListenableFuture<T>


    public class MonoToListenableFutureAdapter<T>
    extends java.lang.Object
    A Mono-to-ListenableFuture adapter where the source and the target from the Promise and the ListenableFuture respectively are of the same type.
    Since:
    5.0
    Author:
    Rossen Stoyanchev, Stephane Maldini
    • Constructor Detail

      • MonoToListenableFutureAdapter

        public MonoToListenableFutureAdapter(reactor.core.publisher.Mono<T> mono)
    • Method Detail

      • get

        @Nullable
        public T get()
                        throws java.lang.InterruptedException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Throws:
        java.lang.InterruptedException
      • get

        @Nullable
        public T get(long timeout,
                               java.util.concurrent.TimeUnit unit)
                        throws java.lang.InterruptedException,
                               java.util.concurrent.ExecutionException,
                               java.util.concurrent.TimeoutException
        Specified by:
        get in interface java.util.concurrent.Future<T>
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.util.concurrent.TimeoutException
      • cancel

        public boolean cancel(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<T>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface java.util.concurrent.Future<T>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface java.util.concurrent.Future<T>
      • addCallback

        public void addCallback(SuccessCallback<? super T> successCallback,
                                FailureCallback failureCallback)
        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