Skip to content

Commit

Permalink
Fixed image links in README (ReactiveX#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobWin authored and storozhukBM committed Mar 23, 2017
1 parent 22454b9 commit a663f25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ long nanosToWaitForPermission = atomicLimiter.getNanosToWait();

The CircuitBreaker is implemented via a finite state machine with three states: `CLOSED`, `OPEN` and `HALF_OPEN`.

image::src/docs/asciidoc/images/state_machine.jpg[]
image::resilience4j-documentation/src/docs/asciidoc/images/state_machine.jpg[]

The CircuitBreaker does not know anything about the backend's state by itself, but uses the information provided by the decorators via `CircuitBreaker::onSuccess()` and `CircuitBreaker::onError(throwable)`. See example:

Expand All @@ -264,7 +264,7 @@ Then, all access to the backend is blocked for a (configurable) time duration. `

The CircuitBreaker uses a Ring Bit Buffer in the `CLOSED` state to store the success or failure statuses of the calls. A successful call is stored as a `0` bit and a failed call is stored as a `1` bit. The Ring Bit Buffer has a (configurable) fixed-size. The Ring Bit Buffer uses internally a https://docs.oracle.com/javase/8/docs/api/java/util/BitSet.html[BitSet] like data structure to store the bits which is saving memory compared to a boolean array. The BitSet uses a long[] array to store the bits. That means the BitSet only needs an array of 16 long (64-bit) values to store the status of 1024 calls.

image:resilience4j-documentation/:src/docs/asciidoc/images/ring_buffer.jpg[Ring Bit Buffer]
image::resilience4j-documentation/src/docs/asciidoc/images/ring_buffer.jpg[Ring Bit Buffer]

The Ring Bit Buffer must be full, before the failure rate can be calculated.
For example, if the size of the Ring Buffer is 10, then at least 10 calls must evaluated, before the failure rate can be calculated. If only 9 calls have been evaluated the CircuitBreaker will not trip open even if all 9 calls have failed.
Expand Down

0 comments on commit a663f25

Please sign in to comment.