Gets the custom retry policy.

@param props
the props
@return the custom retry policy
@throws ClassNotFoundException
@throws IllegalAccessException
@throws NoSuchMethodException
@throws InvocationTargetException
@throws Exception
the exception
509760
private com.datastax.driver.core.policies.RetryPolicy getCustomRetryPolicy(Properties props)

    {
        String customRetryPolicy = (String) props.get(CUSTOM_RETRY_POLICY);
        Class<?> clazz = null;
        Method getter = null;
        try
        {
            clazz = Class.forName(customRetryPolicy);
            com.datastax.driver.core.policies.RetryPolicy retryPolicy = (com.datastax.driver.core.policies.RetryPolicy) KunderaCoreUtils
                    .createNewInstance(clazz);
            if (retryPolicy != null)
            {
                return retryPolicy;
            }
            getter = clazz.getDeclaredMethod(GET_INSTANCE);
            return (com.datastax.driver.core.policies.RetryPolicy) getter.invoke(null, (Object[]) null);
        }
        catch (ClassNotFoundException e)
        {
            logger.error(e.getMessage());
            throw new KunderaException("Please make sure class " + customRetryPolicy
                    + " set in property file exists in classpath " + e.getMessage());
        }
        catch (IllegalAccessException e)
        {
            logger.error(e.getMessage());
            throw new KunderaException("Method " + getter.getName() + " must be declared public " + e.getMessage());
        }
        catch (NoSuchMethodException e)
        {
            logger.error(e.getMessage());
            throw new KunderaException("Please make sure getter method of " + clazz.getSimpleName()
                    + " is named \"getInstance()\"");
        }
        catch (InvocationTargetException e)
        {
            logger.error(e.getMessage());
            throw new KunderaException("Error while executing \"getInstance()\" method of Class "
                    + clazz.getSimpleName() + ": " + e.getMessage());
        }
    }
1031679
@SuppressWarnings("unchecked")
  public static <T> ComposableFuture<T> retry(final int retries, final Function<Integer, ComposableFuture<T>> producer) {
    final BiFunction<BiFunction, Integer, ComposableFuture<T>> retriable = (f, attempt) ->
      Try.apply(() -> producer.apply(attempt)).
        recover(ComposableFutures::fromError).
        map(action -> action.recoverWith(error -> {
            if (attempt >= retries) {
              return fromError(error);
            }

            // we can't safely use generics here since we'll get into infinite nested generics
            return (ComposableFuture<T>) f.apply(f, attempt + 1);
          })
        ).getValue();

    return retriable.apply(retriable, 0);
  }
239981
public RetryInterceptorBuilder<T> backOffPolicy(BackOffPolicy policy) {
		Assert.isNull(this.retryOperations,
				"cannot set the back off policy when a custom retryOperations has been set");
		Assert.isTrue(!this.backOffOptionsSet,
				"cannot set the back off policy when the back off policy options have been set");
		this.retryTemplate.setBackOffPolicy(policy);
		this.templateAltered = true;
		this.backOffPolicySet = true;
		return this;
	}
1031999
@Override
	public RetryContext open(RetryContext parent) {
		List<RetryContext> list = new ArrayList<RetryContext>();
		for (RetryPolicy policy : this.policies) {
			list.add(policy.open(parent));
		}
		return new CompositeRetryContext(parent, list, this.policies);
	}
908566
public Retryer<R> retryIfResult(final Predicate<R> decision) {
        rejection = or(rejection, new Predicate<Tried<R>>() {

            @Override public boolean apply(Tried<R> input) {
                return input.hasResult() ? decision.apply(input.getResult()) : false;
            }
        });
        
        return this;
    }
111583
public JType getGenericReturnType()
  {
    try {
      Type retType = _method.getGenericReturnType();

      if (retType instanceof Class)
  return _loader.forName(((Class) retType).getName());
      else
  return new JTypeWrapper(_loader, (ParameterizedType) retType);
    } catch (NoSuchMethodError e) {
      return getReturnType();
    }

  }
138251
public boolean canRetry(RetryContext context) {
		RetryPolicy policy = (RetryPolicy) context;
		return policy.canRetry(context);
	}
453456
public HTTPRequest retry(final int maxRetries, final Retryable retryable, final WaitStrategy waitStrategy) {
        if (maxRetries <= 0) {
            throw new IllegalArgumentException("maxRetries must be > 0");
        }
        if (retryable == null) {
            throw new IllegalArgumentException("retryable must not be null");
        }
        if (waitStrategy == null) {
            throw new IllegalArgumentException("waitStrategy must not be null");
        }
        this.maxRetries = maxRetries;
        this.retryable = retryable;
        this.waitStrategy = waitStrategy;
        return this;
    }
685879
public void loadClassifierNoExceptions(InputStream in, Properties props) {
    // load the classifier
    try {
      loadClassifier(in, props);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }

  }
419329
def with_retry(cls, methods):
    
    retry_with_backoff = retry(
        retry_on_exception=lambda e: isinstance(e, BotoServerError),
        wait_exponential_multiplier=1000,
        wait_exponential_max=10000
    )
    for method in methods:
        m = getattr(cls, method, None)
        if isinstance(m, collections.Callable):
            setattr(cls, method, retry_with_backoff(m))
    return cls
961555
public static final RetryPolicy retryByException(RetryPolicy defaultPolicy,
                                                   Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap) {
    return new ExceptionDependentRetry(defaultPolicy, exceptionToPolicyMap);
  }
1262389
public RetryerBuilder<V> retryIfResult(@Nonnull Predicate<V> resultPredicate) {
        Preconditions.checkNotNull(resultPredicate, "resultPredicate may not be null");
        rejectionPredicate = Predicates.or(rejectionPredicate, new ResultPredicate<V>(resultPredicate));
        return this;
    }
312669
@Override
	public void registerThrowable(RetryContext context, Throwable throwable) {
		RetryContext[] contexts = ((CompositeRetryContext) context).contexts;
		RetryPolicy[] policies = ((CompositeRetryContext) context).policies;
		for (int i = 0; i < contexts.length; i++) {
			policies[i].registerThrowable(contexts[i], throwable);
		}
		((RetryContextSupport) context).registerThrowable(throwable);
	}
120421
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException {
        String url = ApiBuilder.create(properties);
        try {
            T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz));
            int retry = 1;

            while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) {
                LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry);
                sleeper(retry++);
                wrapper = MAPPER.readValue(getContent(url), clazz);
            }

            if (wrapper.isValid()) {
                return wrapper;
            } else {
                throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url);
            }
        } catch (IOException ex) {
            throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex);
        }
    }
204680
public <T extends Exception> T rethrow(Class<T> exceptionType) {
		return exceptionType.cast(getCause());
	}
364727
protected int getRetryInterval() throws ActivityException {
        try {
            String v = getAttributeValueSmart(PROP_RETRY_INTERVAL);
            return StringHelper.getInteger(v, 600);
        }
        catch (PropertyException ex) {
            throw new ActivityException(ex.getMessage(), ex);
        }
    }
448802
public void setPolicies(RetryPolicy[] policies) {
		this.policies = Arrays.asList(policies).toArray(new RetryPolicy[policies.length]);
	}