All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.ydb.common.retry.ErrorPolicy Maven / Gradle / Ivy

package tech.ydb.common.retry;

/**
 * Recipes should use the configured error policy to decide how to retry
 * errors like unsuccessful {@link tech.ydb.core.StatusCode}.
 *
 * @author Aleksandr Gorshenin
 * @param  Type of errors to check
 */
public interface ErrorPolicy {

    /**
     * Returns true if the given value should be retried
     *
     * @param value value to check
     * @return true if value is retryable
     */
    boolean isRetryable(T value);

    /**
     * Returns true if the given exception should be retried
     * Usually exceptions are never retried, but some policies can implement more difficult logic
     *
     * @param ex exception to check
     * @return true if exception is retryable
     */
    default boolean isRetryable(Exception ex) {
        return false;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy