/** * Create a new {@link CircuitBreaker} and map it to the provided name. * If the CircuitBreaker already exists, then the existing instance is * returned. * @param name the name of the {@link CircuitBreaker} * @param config the {@link CircuitBreakerConfig} with the configuration * values. * @return the created {@link CircuitBreaker} */ public synchronized CircuitBreaker createCircuitBreaker(String name, CircuitBreakerConfig config) { CircuitBreaker circuitBreaker = findCircuitBreaker(name); if (circuitBreaker == null) { circuitBreaker = new CircuitBreaker(name); configureCircuitBreaker(name, circuitBreaker, config); addCircuitBreakerToMap(name, circuitBreaker); } return circuitBreaker; }