Skip to content

Commit

Permalink
Support chaining CircuitBreaker event configurations. Closes #85.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalterman committed Mar 4, 2017
1 parent ec87ba5 commit 52eab10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/net/jodah/failsafe/CircuitBreaker.java
Expand Up @@ -274,22 +274,25 @@ public boolean isOpen() {
/**
* Calls the {@code runnable} when the circuit is closed.
*/
public void onClose(CheckedRunnable runnable) {
public CircuitBreaker onClose(CheckedRunnable runnable) {
onClose = runnable;
return this;
}

/**
* Calls the {@code runnable} when the circuit is half-opened.
*/
public void onHalfOpen(CheckedRunnable runnable) {
public CircuitBreaker onHalfOpen(CheckedRunnable runnable) {
onHalfOpen = runnable;
return this;
}

/**
* Calls the {@code runnable} when the circuit is opened.
*/
public void onOpen(CheckedRunnable runnable) {
public CircuitBreaker onOpen(CheckedRunnable runnable) {
onOpen = runnable;
return this;
}

/**
Expand Down

0 comments on commit 52eab10

Please sign in to comment.