@Override
    protected void doApply(ApiResponse response, IPolicyContext context, CircuitBreakerConfigBean config,
            IPolicyChain<ApiResponse> chain) {
        Circuit circuit = context.getAttribute(CircuitBreakerPolicy.class.getName() + ".circuit", (Circuit) null); //$NON-NLS-1$
        boolean isFault = isCircuitFault(response, config);
        if (circuit.isResetting()) {
            if (isFault) {
                circuit.trip();
            } else {
                circuit.reset();
            }
        } else {
            if (isFault) {
                circuit.addFault();
            }
        }
        super.doApply(response, context, config, chain);
    }
@see io.apiman.gateway.engine.policies.AbstractMappedPolicy#doApply(io.apiman.gateway.engine.beans.ApiResponse, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.policy.IPolicyChain)
plugins/circuit-breaker-policy/src/main/java/io/apiman/plugins/circuit_breaker/CircuitBreakerPolicy.java