org.stuartgunter.dropwizard.cassandra.speculativeexecution.ConstantSpeculativeExecutionPolicyFactory 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
Dropwizard Bundle for Cassandra
                
             The newest version!
        
        package org.stuartgunter.dropwizard.cassandra.speculativeexecution;
import com.datastax.driver.core.policies.ConstantSpeculativeExecutionPolicy;
import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.dropwizard.util.Duration;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
 * A factory for configuring and building {@link ConstantSpeculativeExecutionPolicy} instances.
 * 
 * Configuration Parameters:
 * 
 *     
 *         Name 
 *         Default 
 *         Description 
 *      
 *     
 *         delay 
 *         No default. You must provide a value. 
 *         The delay between each speculative execution. Must be strictly positive. 
 *      
 *     
 *         maxSpeculativeExecutions 
 *         No default. You must provide a value. 
 *         The number of speculative executions. Must be strictly positive. 
 *      
 * 
 */
@JsonTypeName("constant")
public class ConstantSpeculativeExecutionPolicyFactory implements SpeculativeExecutionPolicyFactory {
    @NotNull
    private Duration delay;
    @NotNull
    @Min(1)
    private Integer maxSpeculativeExecutions;
    @JsonProperty
    public Duration getDelay() {
        return delay;
    }
    @JsonProperty
    public void setDelay(Duration delay) {
        this.delay = delay;
    }
    @JsonProperty
    public Integer getMaxSpeculativeExecutions() {
        return maxSpeculativeExecutions;
    }
    @JsonProperty
    public void setMaxSpeculativeExecutions(Integer maxSpeculativeExecutions) {
        this.maxSpeculativeExecutions = maxSpeculativeExecutions;
    }
    @Override
    public SpeculativeExecutionPolicy build() {
        return new ConstantSpeculativeExecutionPolicy(delay.toMilliseconds(), maxSpeculativeExecutions);
    }
}
    © 2015 - 2025 Weber Informatics LLC | Privacy Policy