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

org.kiwiproject.retry.SimpleRetryerConfig Maven / Gradle / Ivy

Go to download

Kiwi is a utility library. We really like Google's Guava, and also use Apache Commons. But if they don't have something we need, and we think it is useful, this is where we put it.

The newest version!
package org.kiwiproject.retry;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.Getter;
import lombok.Setter;
import org.slf4j.event.Level;

import java.util.concurrent.TimeUnit;

/**
 * Configuration class that can be used to configure {@link SimpleRetryer} instances. This is
 * intended for usage with external configurations, e.g., a YAML configuration file, that will
 * be validated once instantiated. You can construct {@link SimpleRetryer} instances directly
 * from this instance using {@link #newRetryer}.
 * 

* When constructing programmatically, prefer creating directly via {@code SimpleRetryer.builder()}. */ @Getter @Setter public class SimpleRetryerConfig { @Positive int maxAttempts = SimpleRetryer.DEFAULT_MAX_ATTEMPTS; @Positive long retryDelayTime = SimpleRetryer.DEFAULT_RETRY_DELAY_TIME; @NotNull TimeUnit retryDelayUnit = SimpleRetryer.DEFAULT_RETRY_DELAY_UNIT; @NotBlank String commonType = SimpleRetryer.DEFAULT_TYPE; @NotNull Level logLevelForSubsequentAttempts = SimpleRetryer.DEFAULT_RETRY_LOG_LEVEL; /** * Construct a new instance using the values in this configuration. * * @return a new retryer instance */ public SimpleRetryer newRetryer() { return SimpleRetryer.builder() .maxAttempts(maxAttempts) .retryDelayTime(retryDelayTime) .retryDelayUnit(retryDelayUnit) .commonType(commonType) .logLevelForSubsequentAttempts(logLevelForSubsequentAttempts) .build(); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy