io.dropwizard.health.conf.Schedule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-health Show documentation
Show all versions of dropwizard-health Show documentation
Provides a health check implementation that performs ongoing monitoring of an application's dependencies and includes
an endpoint that can be called by a load balancer to determine if the application is healthy and thus able to retrieve
traffic.
package io.dropwizard.health.conf;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.util.Duration;
import java.util.Objects;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
public class Schedule {
@NotNull
@JsonProperty
private Duration checkInterval = Duration.seconds(5);
@NotNull
@JsonProperty
private Duration downtimeInterval = Duration.seconds(30);
@Min(0)
@JsonProperty
private int failureAttempts = 3;
@Min(0)
@JsonProperty
private int successAttempts = 2;
public Duration getCheckInterval() {
return checkInterval;
}
public void setCheckInterval(final Duration checkInterval) {
this.checkInterval = checkInterval;
}
public Duration getDowntimeInterval() {
return downtimeInterval;
}
public void setDowntimeInterval(final Duration downtimeInterval) {
this.downtimeInterval = downtimeInterval;
}
public int getFailureAttempts() {
return failureAttempts;
}
public void setFailureAttempts(final int failureAttempts) {
this.failureAttempts = failureAttempts;
}
public int getSuccessAttempts() {
return successAttempts;
}
public void setSuccessAttempts(final int successAttempts) {
this.successAttempts = successAttempts;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (!(o instanceof Schedule)) return false;
final Schedule schedule = (Schedule) o;
return failureAttempts == schedule.failureAttempts &&
successAttempts == schedule.successAttempts &&
Objects.equals(checkInterval, schedule.checkInterval) &&
Objects.equals(downtimeInterval, schedule.downtimeInterval);
}
@Override
public int hashCode() {
return Objects.hash(checkInterval, downtimeInterval, failureAttempts, successAttempts);
}
}