Skip to content

Commit

Permalink
NO JIRA: remove unused CircuitBreaker.getDebugInfo() methods (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoerschke authored Sep 15, 2023
1 parent 55a3908 commit ee5e70a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public class CPUCircuitBreaker extends CircuitBreaker {

private double cpuUsageThreshold;

// Assumption -- the value of these parameters will be set correctly before invoking
// getDebugInfo()
private static final ThreadLocal<Double> seenCPUUsage = ThreadLocal.withInitial(() -> 0.0);

private static final ThreadLocal<Double> allowedCPUUsage = ThreadLocal.withInitial(() -> 0.0);
Expand Down Expand Up @@ -77,16 +75,6 @@ public boolean isTripped() {
return (localSeenCPUUsage >= localAllowedCPUUsage);
}

@Override
public String getDebugInfo() {

if (seenCPUUsage.get() == 0.0 || allowedCPUUsage.get() == 0.0) {
log.warn("CPUCircuitBreaker's monitored values (seenCPUUSage, allowedCPUUsage) not set");
}

return "seenCPUUSage=" + seenCPUUsage.get() + " allowedCPUUsage=" + allowedCPUUsage.get();
}

@Override
public String getErrorMessage() {
return "CPU Circuit Breaker triggered as seen CPU usage is above allowed threshold. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ public CircuitBreaker() {}
/** Check if circuit breaker is tripped. */
public abstract boolean isTripped();

/** Get debug useful info. */
public abstract String getDebugInfo();

/** Get error message when the circuit breaker triggers */
public abstract String getErrorMessage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,6 @@ public boolean isTripped() {
return (memEnabled && memCB.isTripped()) || (cpuEnabled && cpuCB.isTripped());
}

@Override
public String getDebugInfo() {
StringBuilder sb = new StringBuilder();
if (memEnabled) {
sb.append(memCB.getDebugInfo());
}
if (memEnabled && cpuEnabled) {
sb.append("\n");
}
if (cpuEnabled) {
sb.append(cpuCB.getDebugInfo());
}
return sb.toString();
}

@Override
public String getErrorMessage() {
StringBuilder sb = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public class MemoryCircuitBreaker extends CircuitBreaker {

private long heapMemoryThreshold;

// Assumption -- the value of these parameters will be set correctly before invoking
// getDebugInfo()
private static final ThreadLocal<Long> seenMemory = ThreadLocal.withInitial(() -> 0L);
private static final ThreadLocal<Long> allowedMemory = ThreadLocal.withInitial(() -> 0L);

Expand Down Expand Up @@ -78,15 +76,6 @@ public boolean isTripped() {
return (localSeenMemory >= localAllowedMemory);
}

@Override
public String getDebugInfo() {
if (seenMemory.get() == 0L || allowedMemory.get() == 0L) {
log.warn("MemoryCircuitBreaker's monitored values (seenMemory, allowedMemory) not set");
}

return "seenMemory=" + seenMemory.get() + " allowedMemory=" + allowedMemory.get();
}

@Override
public String getErrorMessage() {
return "Memory Circuit Breaker triggered as JVM heap usage values are greater than allocated threshold. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ public MockCircuitBreaker(boolean tripped) {
public boolean isTripped() {
return this.tripped;
}

@Override
public String getDebugInfo() {
return "MockCircuitBreaker";
}
}

private static class FakeMemoryPressureCircuitBreaker extends MemoryCircuitBreaker {
Expand Down

0 comments on commit ee5e70a

Please sign in to comment.