Class JsFutures


  • public class JsFutures
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      JsFutures()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <R> java.util.function.Supplier<java.util.concurrent.CompletableFuture<R>> retry​(java.util.function.Supplier<java.util.concurrent.CompletableFuture<R>> supplier, int maxRetries)
      it creates a new future that retries a number of times the given one when an exception is produced
      • Methods inherited from class java.lang.Object

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

      • JsFutures

        public JsFutures()
    • Method Detail

      • retry

        public static <R> java.util.function.Supplier<java.util.concurrent.CompletableFuture<R>> retry​(java.util.function.Supplier<java.util.concurrent.CompletableFuture<R>> supplier,
                                                                                                       int maxRetries)
        it creates a new future that retries a number of times the given one when an exception is produced
        Type Parameters:
        R - the type of the value returned when the future is completed
        Parameters:
        supplier - the completable future wrapped in a supplier
        maxRetries - the number of retries
        Returns:
        a new CompletableFuture wrapped in a supplier