Created: 2012-08-21 11:11
Updated: 2014-01-26 03:59


This project provides a 'service' for testing an implementation of the Circuit Breaker pattern as described in the book "ReleaseIt!" by the pragmatic programmers:

The relevant extract from the book describing the pattern as a PDF is in the docs folder.


The service object provides a method called serviceCall that 75% of the time returns true (to denote success), and the remaining 25% of the time false, to denote failure.

Service has a constructor that allows the limit to be set as an Integer, so 75% of this limit the calls succeed, the following 25% fail.

Unit tests show examples of how to use it. There is also a concurrent unit test to show this is thread safe.

#Circuit Breaker# Based roughly on the following logic:

When Circuit is Closed:
on call = pass through
call succeeds = reset count
call fails = count failure
threshold reached = trip breaker. Open State

when Circuit is Half-Open
on call = pass through
call succeeds = reset go. Close State
call fails = trip breaker. Open State

when Circuit is Open
on call = return/fail
on timeout = attempt reset. Half-Open State




Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more