@Test public void testCloseCircuit() { LOGGER.info("Test: expect status is OPEN after an explicit close"); this.markTwoFailures(); this.circuitBreaker.closeCircuit(); assertThat(this.circuitBreaker.isClosed()) .withFailMessage("Should be CLOSED after explicit close circuit request") .isTrue(); }
public void closeCircuit() { this.lock.lock(); try { this.countDown = this.threshold; if (this.status != Status.CLOSED) { LOGGER.info("Close circuit"); this.currentDuration = this.initialDuration; this.status = Status.CLOSED; this.closeCircuitInstant = null; } } finally { this.lock.unlock(); } }
CircuitBreaker { public void closeCircuit() { this.lock.lock(); try { this.countDown = this.threshold; if (this.status != Status.CLOSED) { LOGGER.info("Close circuit"); this.currentDuration = this.initialDuration; this.status = Status.CLOSED; this.closeCircuitInstant = null; } } finally { this.lock.unlock(); } } }
CircuitBreaker { public void closeCircuit() { this.lock.lock(); try { this.countDown = this.threshold; if (this.status != Status.CLOSED) { LOGGER.info("Close circuit"); this.currentDuration = this.initialDuration; this.status = Status.CLOSED; this.closeCircuitInstant = null; } } finally { this.lock.unlock(); } } private  CircuitBreaker(final Builder builder); }
CircuitBreaker { public void closeCircuit() { this.lock.lock(); try { this.countDown = this.threshold; if (this.status != Status.CLOSED) { LOGGER.info("Close circuit"); this.currentDuration = this.initialDuration; this.status = Status.CLOSED; this.closeCircuitInstant = null; } } finally { this.lock.unlock(); } } private  CircuitBreaker(final Builder builder); void openCircuit(); void closeCircuit(); boolean isClosed(); void markSuccess(); void markFailure(); }
CircuitBreaker { public void closeCircuit() { this.lock.lock(); try { this.countDown = this.threshold; if (this.status != Status.CLOSED) { LOGGER.info("Close circuit"); this.currentDuration = this.initialDuration; this.status = Status.CLOSED; this.closeCircuitInstant = null; } } finally { this.lock.unlock(); } } private  CircuitBreaker(final Builder builder); void openCircuit(); void closeCircuit(); boolean isClosed(); void markSuccess(); void markFailure();  }