Class ClientUtils

java.lang.Object
io.vrap.rmf.base.client.utils.ClientUtils

public class ClientUtils extends Object
  • Constructor Details

    • ClientUtils

      public ClientUtils()
  • Method Details

    • blockingWait

      public static <T> T blockingWait(CompletionStage<T> completionStage, ApiHttpRequest request, Duration duration)
      Waits with a timeout for RESPONSES of a client wrapped in a CompletionStage. This method should not be used for other CompletionStages since it is throwing BaseExceptions.
      Type Parameters:
      T - type of the result for the request
      Parameters:
      completionStage - the future monad to wait for
      request - the request belonging to the completionStage
      duration - the maximum duration to wait for this single request
      Returns:
      the wrapped value of completionStage
      Throws:
      RmfTimeoutException - if a timeout occurs
    • blockingWait

      public static <T> T blockingWait(CompletionStage<T> completionStage, Duration duration)
      Waits with a timeout for RESPONSES of a client wrapped in a CompletionStage. This method should not be used for other CompletionStages since it is throwing BaseExceptions.
      Type Parameters:
      T - type of the result for the request
      Parameters:
      completionStage - the future monad to wait for
      duration - the maximum duration to wait for this single request
      Returns:
      the wrapped value of completionStage
      Throws:
      RmfTimeoutException - if a timeout occurs
    • blockingWait

      public static <T> T blockingWait(CompletionStage<T> completionStage, long timeout, TimeUnit unit)
      Waits with a timeout for RESPONSES of a client wrapped in a CompletionStage. This method should not be used for other CompletionStages since it is throwing BaseExceptions.
      Type Parameters:
      T - type of the result for the request
      Parameters:
      completionStage - the future monad to wait for
      timeout - the maximum time to wait for this single request
      unit - the time unit of the timeout argument
      Returns:
      the wrapped value of completionStage
      Throws:
      RmfTimeoutException - if a timeout occurs
    • blockingWait

      public static <T> T blockingWait(CompletionStage<T> completionStage, ApiHttpRequest request, long timeout, TimeUnit unit)
      Waits with a timeout for RESPONSES of a client wrapped in a CompletionStage. This method should not be used for other CompletionStages since it is throwing BaseExceptions.
      Type Parameters:
      T - type of the result for the request
      Parameters:
      completionStage - the future monad to wait for
      request - the request belonging to the completionStage
      timeout - the maximum time to wait for this single request
      unit - the time unit of the timeout argument
      Returns:
      the wrapped value of completionStage
      Throws:
      RmfTimeoutException - if a timeout occurs
    • blockingWaitForEach

      public static <T> List<T> blockingWaitForEach(Stream<? extends CompletionStage<T>> stream, Duration duration)
    • blockingWaitForEach

      public static <T> List<T> blockingWaitForEach(Stream<? extends CompletionStage<T>> stream, long timeout, TimeUnit unit)
    • blockingWaitForEach

      public static <T> List<T> blockingWaitForEach(List<? extends CompletionStage<T>> list, Duration duration)
    • blockingWaitForEach

      public static <T> List<T> blockingWaitForEach(List<? extends CompletionStage<T>> list, long timeout, TimeUnit unit)
    • blockingWaitForEachCollector

      public static <S extends CompletionStage<T>, T> Collector<S,?,List<T>> blockingWaitForEachCollector(long timeout, TimeUnit unit)
    • blockingWaitForEachCollector

      public static <S extends CompletionStage<T>, T> Collector<S,?,List<T>> blockingWaitForEachCollector(Duration duration)