Package 

Class WalletServiceKt

    • Method Summary

      Modifier and Type Method Description
      final static Unit retryUpToAndThrow(Integer retries, Function1<Throwable, Throwable> exceptionWrapper, Long initialDelayMillis, Function1<Integer, Unit> block) Execute the given block and if it fails, retry up to retries more times.
      final static Unit retryUpToAndContinue(Integer retries, Function1<Throwable, Throwable> exceptionWrapper, Long initialDelayMillis, Function1<Integer, Unit> block) Execute the given block and if it fails, retry up to retries more times.
      final static Unit retryWithBackoff(Function1<Throwable, Boolean> onErrorListener, Long initialDelayMillis, Long maxDelayMillis, Function0<Unit> block) Execute the given block and if it fails, retry with an exponential backoff.
      • Methods inherited from class java.lang.Object

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

      • retryUpToAndThrow

         final static Unit retryUpToAndThrow(Integer retries, Function1<Throwable, Throwable> exceptionWrapper, Long initialDelayMillis, Function1<Integer, Unit> block)

        Execute the given block and if it fails, retry up to retries more times. If none of the retries succeed then throw the final error, which can be wrapped in order to add more context.

        Parameters:
        retries - the number of times to retry the block after the first attempt fails.
        exceptionWrapper - a function that can wrap the final failure to add more useful information or context.
        initialDelayMillis - the initial amount of time to wait before the first retry.
        block - the code to execute, which will be wrapped in a try/catch and retried whenever an exception is thrown up to retries attempts.
      • retryUpToAndContinue

         final static Unit retryUpToAndContinue(Integer retries, Function1<Throwable, Throwable> exceptionWrapper, Long initialDelayMillis, Function1<Integer, Unit> block)

        Execute the given block and if it fails, retry up to retries more times. If none of the retries succeed, then leave the block execution unfinished and continue.

        Parameters:
        retries - the number of times to retry the block after the first attempt fails.
        exceptionWrapper - a function that can wrap the final failure to add more useful information or context.
        initialDelayMillis - the initial amount of time to wait before the first retry.
        block - the code to execute, which will be wrapped in a try/catch and retried whenever an exception is thrown up to retries attempts.
      • retryWithBackoff

         final static Unit retryWithBackoff(Function1<Throwable, Boolean> onErrorListener, Long initialDelayMillis, Long maxDelayMillis, Function0<Unit> block)

        Execute the given block and if it fails, retry with an exponential backoff.

        Parameters:
        onErrorListener - a callback that gets the first shot at processing any error and can veto the retry behavior by returning false.
        initialDelayMillis - the initial delay before retrying.
        maxDelayMillis - the maximum delay between retries.
        block - the logic to run once and then run again if it fails.