<commit_before>package com.blogspot.nurkiewicz.asyncretry.policy;

import com.blogspot.nurkiewicz.asyncretry.RetryContext;
import com.blogspot.nurkiewicz.asyncretry.policy.exception.AbortPredicateRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.exception.ExceptionClassRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.random.ProportionalRandomJitterRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.random.UniformRandomJitterRetryPolicy;

import java.util.function.Predicate;

/**
 * @author <NAME>
 * @since 7/16/13, 6:05 PM
 */
public interface RetryPolicy {

	RetryPolicy DEFAULT = new FixedIntervalRetryPolicy();

	long delayMillis(RetryContext context);

	default boolean shouldContinue(RetryContext context) {
		return true;
	}

	default RetryPolicy retryFor(Class<Throwable> retryForThrowable) {
		return ExceptionClassRetryPolicy.retryFor(this, retryForThrowable);
	}

	default RetryPolicy abortFor(Class<Throwable> retryForThrowable) {
		return ExceptionClassRetryPolicy.abortFor(this, retryForThrowable);
	}

	default RetryPolicy abortIf(Predicate<Throwable> retryPredicate) {
		return new AbortPredicateRetryPolicy(this, retryPredicate);
	}

	default RetryPolicy withUniformJitter() {
		return new UniformRandomJitterRetryPolicy(this);
	}

	default RetryPolicy withUniformJitter(long range) {
		return new UniformRandomJitterRetryPolicy(this, range);
	}

	default RetryPolicy withProportionalJitter() {
		return new ProportionalRandomJitterRetryPolicy(this);
	}

	default RetryPolicy withProportionalJitter(double multiplier) {
		return new ProportionalRandomJitterRetryPolicy(this, multiplier);
	}

	default RetryPolicy withMinDelay(long minDelayMillis) {
		return new BoundedMinDelayPolicy(this, minDelayMillis);
	}

	default RetryPolicy withMaxDelay(long maxDelayMillis) {
		return new BoundedMaxDelayPolicy(this, maxDelayMillis);
	}

	default RetryPolicy withMaxRetries(int times) {
		return new MaxRetriesPolicy(this, times);
	}

}<commit_msg>dontRetry() helper method<commit_after>package com.blogspot.nurkiewicz.asyncretry.policy;

import com.blogspot.nurkiewicz.asyncretry.RetryContext;
import com.blogspot.nurkiewicz.asyncretry.policy.exception.AbortPredicateRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.exception.ExceptionClassRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.random.ProportionalRandomJitterRetryPolicy;
import com.blogspot.nurkiewicz.asyncretry.policy.random.UniformRandomJitterRetryPolicy;

import java.util.function.Predicate;

/**
 * @author <NAME>
 * @since 7/16/13, 6:05 PM
 */
public interface RetryPolicy {

	RetryPolicy DEFAULT = new FixedIntervalRetryPolicy();

	long delayMillis(RetryContext context);

	default boolean shouldContinue(RetryContext context) {
		return true;
	}

	default RetryPolicy retryFor(Class<Throwable> retryForThrowable) {
		return ExceptionClassRetryPolicy.retryFor(this, retryForThrowable);
	}

	default RetryPolicy abortFor(Class<Throwable> retryForThrowable) {
		return ExceptionClassRetryPolicy.abortFor(this, retryForThrowable);
	}

	default RetryPolicy abortIf(Predicate<Throwable> retryPredicate) {
		return new AbortPredicateRetryPolicy(this, retryPredicate);
	}

	default RetryPolicy withUniformJitter() {
		return new UniformRandomJitterRetryPolicy(this);
	}

	default RetryPolicy withUniformJitter(long range) {
		return new UniformRandomJitterRetryPolicy(this, range);
	}

	default RetryPolicy withProportionalJitter() {
		return new ProportionalRandomJitterRetryPolicy(this);
	}

	default RetryPolicy withProportionalJitter(double multiplier) {
		return new ProportionalRandomJitterRetryPolicy(this, multiplier);
	}

	default RetryPolicy withMinDelay(long minDelayMillis) {
		return new BoundedMinDelayPolicy(this, minDelayMillis);
	}

	default RetryPolicy withMaxDelay(long maxDelayMillis) {
		return new BoundedMaxDelayPolicy(this, maxDelayMillis);
	}

	default RetryPolicy dontRetry() {
		return withMaxRetries(0);
	}

	default RetryPolicy withMaxRetries(int times) {
		return new MaxRetriesPolicy(this, times);
	}
}
{'fraction_non_alphanumeric': 0.08079567779960707, 'fraction_numerical': 0.004174852652259332, 'mean_word_length': 7.0813492063492065, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3874359', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1266, 'n_words': 227}