public static <V> V poll( Callable<V> callable, RetrySettings pollSettings, ResultRetryAlgorithm<V> resultPollAlgorithm, ApiClock clock) throws ExecutionException, InterruptedException { return run(callable, new ExponentialPollAlgorithm(pollSettings, clock), resultPollAlgorithm); }
public static <V> V runWithRetries( Callable<V> callable, RetrySettings retrySettings, ResultRetryAlgorithm<?> resultRetryAlgorithm, ApiClock clock) throws RetryHelperException { try { // Suppressing should be ok as a workaraund. Current and only ResultRetryAlgorithm // implementation does not use response at all, so ignoring its type is ok. @SuppressWarnings("unchecked") ResultRetryAlgorithm<V> algorithm = (ResultRetryAlgorithm<V>) resultRetryAlgorithm; return run(callable, new ExponentialRetryAlgorithm(retrySettings, clock), algorithm); } catch (Exception e) { // TODO: remove RetryHelperException, throw InterruptedException or // ExecutionException#getCause() explicitly throw new RetryHelperException(e.getCause()); } }
public static <V> V poll( Callable<V> callable, RetrySettings pollSettings, ResultRetryAlgorithm<V> resultPollAlgorithm, ApiClock clock) throws ExecutionException, InterruptedException { return run(callable, new ExponentialPollAlgorithm(pollSettings, clock), resultPollAlgorithm); }
public static <V> V runWithRetries( Callable<V> callable, RetrySettings retrySettings, ResultRetryAlgorithm<?> resultRetryAlgorithm, ApiClock clock) throws RetryHelperException { try { // Suppressing should be ok as a workaraund. Current and only ResultRetryAlgorithm // implementation does not use response at all, so ignoring its type is ok. @SuppressWarnings("unchecked") ResultRetryAlgorithm<V> algorithm = (ResultRetryAlgorithm<V>) resultRetryAlgorithm; return run(callable, new ExponentialRetryAlgorithm(retrySettings, clock), algorithm); } catch (Exception e) { // TODO: remove RetryHelperException, throw InterruptedException or // ExecutionException#getCause() explicitly throw new RetryHelperException(e.getCause()); } }