systems.composable.dropwizard.cassandra.retry.LoggingRetryPolicyFactory 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
The newest version!
package systems.composable.dropwizard.cassandra.retry;
import com.datastax.driver.core.policies.LoggingRetryPolicy;
import com.datastax.driver.core.policies.RetryPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* A factory for configuring and building {@link LoggingRetryPolicy} instances.
*
* Configuration Parameters:
*
*
* Name
* Default
* Description
*
*
* subPolicy
* No default. You must specify a sub policy.
* The policy to wrap. The policy created by this factory will return the same decision as subPolicy but will log them.
*
*
*/
@JsonTypeName("log")
public class LoggingRetryPolicyFactory implements RetryPolicyFactory {
@NotNull
@Valid
private RetryPolicyFactory subPolicy;
@JsonProperty
public RetryPolicyFactory getSubPolicy() {
return subPolicy;
}
@JsonProperty
public void setSubPolicy(RetryPolicyFactory subPolicy) {
this.subPolicy = subPolicy;
}
@Override
public RetryPolicy build() {
return new LoggingRetryPolicy(subPolicy.build());
}
}