Module mutiny.zero
Package mutiny.zero

Interface AsyncHelpers


  • public interface AsyncHelpers
    • Method Summary

      All Methods Static Methods Deprecated Methods 
      Modifier and Type Method Description
      static <T> java.util.concurrent.CompletionStage<T> applyExceptionally​(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,​java.lang.Throwable> mapper)
      Applies a function on failure to produce another failure.
      static <T> java.util.concurrent.CompletionStage<T> composeExceptionally​(java.util.concurrent.CompletionStage<T> upstream, java.util.function.Function<java.lang.Throwable,​java.util.concurrent.CompletionStage<T>> mapper)
      Composes the given completion stage on failure.
      static <T> java.util.concurrent.CompletionStage<T> failedFuture​(java.lang.Throwable t)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use CompletableFuture.failedFuture(Throwable) instead, this helper method was here while Java 8 compatibility was required.
    • Method Detail

      • failedFuture

        @Deprecated(forRemoval=true,
                    since="0.5.0")
        static <T> java.util.concurrent.CompletionStage<T> failedFuture​(java.lang.Throwable t)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use CompletableFuture.failedFuture(Throwable) instead, this helper method was here while Java 8 compatibility was required.
        Creates a failed completion stage.
        Type Parameters:
        T - the emitted type
        Parameters:
        t - the failure
        Returns:
        the failed completion stage.
      • applyExceptionally

        static <T> java.util.concurrent.CompletionStage<T> applyExceptionally​(java.util.concurrent.CompletionStage<T> upstream,
                                                                              java.util.function.Function<java.lang.Throwable,​java.lang.Throwable> mapper)
        Applies a function on failure to produce another failure.
        Type Parameters:
        T - the type of emitted item
        Parameters:
        upstream - the upstream stage.
        mapper - the mapper
        Returns:
        the mapped completion stage.
      • composeExceptionally

        static <T> java.util.concurrent.CompletionStage<T> composeExceptionally​(java.util.concurrent.CompletionStage<T> upstream,
                                                                                java.util.function.Function<java.lang.Throwable,​java.util.concurrent.CompletionStage<T>> mapper)
        Composes the given completion stage on failure.
        Type Parameters:
        T - the type of emitted item
        Parameters:
        upstream - the upstream stage
        mapper - the mapper
        Returns:
        the composed completion stage.