Class RetryUtils


  • public class RetryUtils
    extends Object
    This class implements RetryStrategies, for explicitly retrying requests to the FCM server.
    • Constructor Detail

      • RetryUtils

        public RetryUtils()
    • Method Detail

      • getWithRetry

        public static <TResult> TResult getWithRetry​(Func1<TResult> function,
                                                     int maxRetries)
        Retries a method with the SimpleRetryStrategy and a maximum amount of retries.
        Type Parameters:
        TResult - The Result of the Method.
        Parameters:
        function - Function to retry.
        maxRetries - The Maximum Number of Retries.
        Returns:
        Result of the Method invocation.
      • getWithRetry

        public static <TResult> TResult getWithRetry​(Func1<TResult> function,
                                                     IRetryStrategy retryStrategy)
        Retries a method with the given Retry Strategy.
        Type Parameters:
        TResult - Result of the invocation.
        Parameters:
        function - Function to retry.
        retryStrategy - RetryStrategy to apply.
        Returns:
        Result of the Method invocation.
      • doWithRetry

        public static void doWithRetry​(Action0 action,
                                       int maxRetries)
        Retries a method with the SimpleRetryStrategy and a maximum amount of retries.
        Parameters:
        action - Action to retry.
        maxRetries - The Maximum Number of Retries.
      • doWithRetry

        public static void doWithRetry​(Action0 action,
                                       IRetryStrategy retryStrategy)
        Retries a method with the given Retry Strategy.
        Parameters:
        action - Action to retry.
        retryStrategy - RetryStrategy to apply.