Circuit-Breaker for Scala


I posted my Scala Implementation of the Circuit Breaker state machine mentioned in the book Release It at github.

I used the GoF State Machine pattern (like Ken DeLong), implemented it in Scala and added some factory stuff.

Use it like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
. . .
addCircuitBreaker("test", CircuitBreakerConfiguration(100,10))
. . .
 
class Test extends UsingCircuitBreaker {
  def myMethodWorkingFine = {
    withCircuitBreaker("test") {
      . . .
    }
  }
 
  def myMethodDoingWrong = {
    withCircuitBreaker("test") {
      throw new java.lang.IllegalArgumentException
    }
  }
}

,

  1. Bisher keine Kommentare.

Sie müssen angemeldet sein, um einen Beitrag zu verfassen.