Class UniOnTimeout<T>


  • public class UniOnTimeout<T>
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      UniOnTimeout​(Uni<T> upstream, java.time.Duration timeout, java.util.concurrent.ScheduledExecutorService executor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UniOnTimeout<T> after​(java.time.Duration timeout)
      Configures the timeout duration.
      Uni<T> fail()  
      Uni<T> failWith​(java.lang.Throwable failure)  
      Uni<T> failWith​(java.util.function.Supplier<? extends java.lang.Throwable> supplier)  
      UniOnTimeout<T> on​(java.util.concurrent.ScheduledExecutorService executor)
      Configures on which executor the timeout is measured.
      Uni<T> recoverWithItem​(java.util.function.Supplier<T> supplier)
      Produces a new Uni firing a fallback item supplied by the given supplier when the current Uni times out.
      Uni<T> recoverWithItem​(T fallback)
      Produces a new Uni firing a fallback item when the current Uni the upstream Uni do not emit an item before the timeout.
      Uni<T> recoverWithUni​(Uni<? extends T> fallback)
      Produces a new Uni providing a fallback Uni when the current Uni times out.
      Uni<T> recoverWithUni​(java.util.function.Supplier<Uni<? extends T>> supplier)
      Produces a new Uni providing a fallback Uni when the current Uni times out.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UniOnTimeout

        public UniOnTimeout​(Uni<T> upstream,
                            java.time.Duration timeout,
                            java.util.concurrent.ScheduledExecutorService executor)
    • Method Detail

      • after

        @CheckReturnValue
        public UniOnTimeout<T> after​(java.time.Duration timeout)
        Configures the timeout duration.
        Parameters:
        timeout - the timeout, must not be null, must be strictly positive.
        Returns:
        a new UniOnTimeout
      • on

        @CheckReturnValue
        public UniOnTimeout<T> on​(java.util.concurrent.ScheduledExecutorService executor)
        Configures on which executor the timeout is measured. Note that this executor is also going to be used to fire the Timeout failure event.
        Parameters:
        executor - the executor to use, must not be null
        Returns:
        a new UniOnTimeout
      • fail

        @CheckReturnValue
        public Uni<T> fail()
      • failWith

        @CheckReturnValue
        public Uni<T> failWith​(java.lang.Throwable failure)
      • failWith

        @CheckReturnValue
        public Uni<T> failWith​(java.util.function.Supplier<? extends java.lang.Throwable> supplier)
      • recoverWithItem

        @CheckReturnValue
        public Uni<T> recoverWithItem​(T fallback)
        Produces a new Uni firing a fallback item when the current Uni the upstream Uni do not emit an item before the timeout.

        The fallback item (potentially null) is used as item by the produced Uni.

        Parameters:
        fallback - the fallback value, may be null
        Returns:
        the new Uni
      • recoverWithItem

        @CheckReturnValue
        public Uni<T> recoverWithItem​(java.util.function.Supplier<T> supplier)
        Produces a new Uni firing a fallback item supplied by the given supplier when the current Uni times out. The produced item (potentially null) is fired as item by the produced Uni. Note that if the supplier throws an exception, the produced Uni emits a failure.
        Parameters:
        supplier - the fallback supplier, may be null
        Returns:
        the new Uni
      • recoverWithUni

        @CheckReturnValue
        public Uni<T> recoverWithUni​(java.util.function.Supplier<Uni<? extends T>> supplier)
        Produces a new Uni providing a fallback Uni when the current Uni times out. The fallback is produced using the given supplier, and it called when the failure is caught. The produced Uni is used instead of the current Uni.
        Parameters:
        supplier - the fallback supplier, must not be null, must not produce null
        Returns:
        the new Uni
      • recoverWithUni

        @CheckReturnValue
        public Uni<T> recoverWithUni​(Uni<? extends T> fallback)
        Produces a new Uni providing a fallback Uni when the current Uni times out. The fallback Uni is used instead of the current Uni.
        Parameters:
        fallback - the fallback Uni, must not be null
        Returns:
        the new Uni