systems.composable.dropwizard.cassandra.reconnection.ConstantReconnectionPolicyFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-cassandra Show documentation
Show all versions of dropwizard-cassandra Show documentation
Cassandra library for Dropwizard
package systems.composable.dropwizard.cassandra.reconnection;
import com.datastax.driver.core.policies.ConstantReconnectionPolicy;
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 ConstantReconnectionPolicy} instances.
*
* Configuration Parameters:
*
*
* Name
* Default
* Description
*
*
* delay
* No default. You must specify a delay.
* The constant delay between reconnection attempts.
*
*
*/
@JsonTypeName("constant")
public class ConstantReconnectionPolicyFactory implements ReconnectionPolicyFactory {
@NotNull
private Duration delay;
@JsonProperty
public Duration getDelay() {
return delay;
}
@JsonProperty
public void setDelay(Duration delay) {
this.delay = delay;
}
@Override
public ReconnectionPolicy build() {
return new ConstantReconnectionPolicy(delay.toMilliseconds());
}
}