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

systems.composable.dropwizard.cassandra.reconnection.ExponentialReconnectionPolicyFactory Maven / Gradle / Ivy

The newest version!
package systems.composable.dropwizard.cassandra.reconnection;

import com.datastax.driver.core.policies.ExponentialReconnectionPolicy;
import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.dropwizard.util.Duration;

import javax.validation.constraints.NotNull;

/**
 * A factory for configuring and building {@link ExponentialReconnectionPolicy} instances.
 * 

* Configuration Parameters: *

* * * * * * * * * * * * * * * *
NameDefaultDescription
baseDelayNo default. You must specify a base delay.The base delay to use for the schedules created by this policy.
maxDelayNo default. You must specify a max delay.The maximum delay to wait between two attempts.
*/ @JsonTypeName("exponential") public class ExponentialReconnectionPolicyFactory implements ReconnectionPolicyFactory { @NotNull private Duration baseDelay; @NotNull private Duration maxDelay; @JsonProperty public Duration getBaseDelay() { return baseDelay; } @JsonProperty public void setBaseDelay(Duration baseDelay) { this.baseDelay = baseDelay; } @JsonProperty public Duration getMaxDelay() { return maxDelay; } @JsonProperty public void setMaxDelay(Duration maxDelay) { this.maxDelay = maxDelay; } @Override public ReconnectionPolicy build() { return new ExponentialReconnectionPolicy(baseDelay.toMilliseconds(), maxDelay.toMilliseconds()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy