Class RetryUtils
- java.lang.Object
-
- io.github.shsmysore.fcmjava.client.retry.RetryUtils
-
public class RetryUtils extends Object
This class implements RetryStrategies, for explicitly retrying requests to the FCM server.
-
-
Constructor Summary
Constructors Constructor Description RetryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddoWithRetry(Action0 action, int maxRetries)Retries a method with the SimpleRetryStrategy and a maximum amount of retries.static voiddoWithRetry(Action0 action, IRetryStrategy retryStrategy)Retries a method with the given Retry Strategy.static <TResult> TResultgetWithRetry(Func1<TResult> function, int maxRetries)Retries a method with the SimpleRetryStrategy and a maximum amount of retries.static <TResult> TResultgetWithRetry(Func1<TResult> function, IRetryStrategy retryStrategy)Retries a method with the given Retry Strategy.
-
-
-
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.
-
-