Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Circuit breakers default to closed * Circuit breakers can be re-configured at any time, and executions recorded from previous configuration will be carried over. * Simplified internal circuit state tracking * Fixes #34
- Loading branch information
1 parent
0209e97
commit efcd0a0
Showing
14 changed files
with
307 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 13 additions & 5 deletions
18
src/main/java/net/jodah/failsafe/internal/CircuitState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
package net.jodah.failsafe.internal; | ||
|
||
import net.jodah.failsafe.CircuitBreaker.State; | ||
import net.jodah.failsafe.util.Ratio; | ||
|
||
/** | ||
* The state of a circuit. | ||
* | ||
* @author Jonathan Halterman | ||
*/ | ||
public interface CircuitState { | ||
boolean allowsExecution(CircuitBreakerStats stats); | ||
public abstract class CircuitState { | ||
static final Ratio ONE_OF_ONE = new Ratio(1, 1); | ||
|
||
State getState(); | ||
public abstract boolean allowsExecution(CircuitBreakerStats stats); | ||
|
||
void recordFailure(); | ||
public abstract State getState(); | ||
|
||
void recordSuccess(); | ||
public void recordFailure() { | ||
} | ||
|
||
public void recordSuccess() { | ||
} | ||
|
||
public void setThreshold(Ratio threshold) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.