Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/rotation-mgmt' into rotation-mgmt
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/main/java/com/flipkart/gjex/core/web/RotationManagementResource.java
#	examples/src/main/java/com/flipkart/gjex/examples/helloworld/guice/HelloWorldModule.java
#	examples/src/main/java/com/flipkart/gjex/examples/helloworld/web/HelloWorldHealthCheckResource.java
  • Loading branch information
ajay-jalgaonkar committed Mar 22, 2024
2 parents c8ce346 + dbedb16 commit 53f9e69
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand All @@ -46,7 +44,7 @@ public String makeBir() {
return BIR;
}

public boolean isBir() {
public boolean inHealthy() {
return state.get();
}

Expand Down

0 comments on commit 53f9e69

Please sign in to comment.