diff --git a/core/src/main/java/com/flipkart/gjex/core/task/RotationManagementBasedHealthCheck.java b/core/src/main/java/com/flipkart/gjex/core/health/ManualRotationManagement.java similarity index 71% rename from core/src/main/java/com/flipkart/gjex/core/task/RotationManagementBasedHealthCheck.java rename to core/src/main/java/com/flipkart/gjex/core/health/ManualRotationManagement.java index f0171790..98487815 100644 --- a/core/src/main/java/com/flipkart/gjex/core/task/RotationManagementBasedHealthCheck.java +++ b/core/src/main/java/com/flipkart/gjex/core/health/ManualRotationManagement.java @@ -1,4 +1,4 @@ -package com.flipkart.gjex.core.task; +package com.flipkart.gjex.core.health; import com.flipkart.gjex.core.logging.Logging; import io.dropwizard.metrics5.health.HealthCheck; @@ -11,29 +11,27 @@ * @author ajay.jalgaonkar */ @Singleton -public class RotationManagementBasedHealthCheck extends HealthCheck implements Logging { +public class ManualRotationManagement extends HealthCheck implements Logging { private static final String BIR = "bir"; private static final String OOR = "oor"; private AtomicBoolean state; - public RotationManagementBasedHealthCheck() { + public ManualRotationManagement() { state = new AtomicBoolean(true); } @Override protected Result check() { - if (isBir()) { - info("Returning healthy status."); + if (inHealthy()) { return Result.healthy("Server is " + getStatus()); } else { - info("Returning unhealthy status."); return Result.unhealthy("Server is " + getStatus()); } } public String getStatus() { - return isBir() ? BIR : OOR; + return inHealthy() ? BIR : OOR; } public String makeOor() { @@ -46,7 +44,7 @@ public String makeBir() { return BIR; } - public boolean isBir() { + public boolean inHealthy() { return state.get(); }