Configurable CircuitBreaker For Java EE

breakr is a simplistic interceptor (6KB) which ignores all calls to the decorated component when a configurable threshold is reached.

The decision when to open or close the circuit and the information about the state of the breakr is maintained in the class com.airhacks.breakr.Circuit.

To introduce custom behavior, just inherit from the Circuit and introduce your own business logic:

public class CustomCircuit extends Circuit {

    private AtomicBoolean open = new AtomicBoolean(false);

    public boolean isOpen(long maxFailures) {
        return open.get();

    public long getFailureCount() {
        return failureCounter.get();

     * controls the closing and opening of the circuit
    public void setOpen(boolean open) {;

For more details checkout

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home:

NEW online workshop: Web Components training (online)

Airport MUC workshops: Java EE 8, Java 9: Bootstrap, Effective, Architectures, Single Page Apps, Progressive Web Apps, HTML 5, ES 6, CSS 3 and Microservices

Podcast: and newsletter:

A book about rethinking Java EE Patterns


Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments