A circuit breaker implementation in Scala