private CircuitState openCircuit(Throwable cause) {
        if (cause == null) {
            throw new IllegalArgumentException("Exception cause cannot be null");
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Opening Circuit Breaker [{}] due to error: {}", method, cause.getMessage());
        }
        this.childState = (MutableRetryState) retryStateBuilder.build();
        this.lastError = cause;
        this.time = System.currentTimeMillis();
        try {
            return state.getAndSet(CircuitState.OPEN);
        } finally {
            if (eventPublisher != null) {
                try {
                    eventPublisher.publishEvent(new CircuitOpenEvent(method, childState, cause));
                } catch (Exception e) {
                    if (LOG.isErrorEnabled()) {
                        LOG.error("Error publishing CircuitOpen event: " + e.getMessage(), e);
                    }
                }
            }
        }
    }
private CircuitState openCircuit ( Throwable cause ) { if ( cause == null ) { throw new IllegalArgumentException ( "Exception cause cannot be null" ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Opening Circuit Breaker [{}] due to error: {}" , method , cause . getMessage ( ) ) ; } this . childState = ( MutableRetryState ) retryStateBuilder . build ( ) ; this . lastError = cause ; this . time = System . currentTimeMillis ( ) ; try { return state . getAndSet ( CircuitState . OPEN ) ; } finally { if ( eventPublisher != null ) { try { eventPublisher . publishEvent ( new CircuitOpenEvent ( method , childState , cause ) ) ; } catch ( Exception e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( "Error publishing CircuitOpen event: " + e . getMessage ( ) , e ) ; } } } } }
Opens the circuit.

@return The current state