Skip to content

Commit

Permalink
Merge pull request ReactiveX#254 from berrueta/issue-249-additional-f…
Browse files Browse the repository at this point in the history
…actory-methods

Additional factory methods - issue ReactiveX#249
  • Loading branch information
storozhukBM authored Aug 18, 2018
2 parents 269a348 + 939e876 commit a9abce7
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ public static CircuitBreakerMetrics ofCircuitBreakerRegistry(CircuitBreakerRegis
return new CircuitBreakerMetrics(circuitBreakerRegistry.getAllCircuitBreakers());
}

/**
* Creates a new instance CircuitBreakerMetrics {@link CircuitBreakerMetrics} with
* an {@link Iterable} of circuit breakers as a source.
*
* @param circuitBreakers the circuit breakers
*/
public static CircuitBreakerMetrics ofIterable(Iterable<CircuitBreaker> circuitBreakers) {
return new CircuitBreakerMetrics(circuitBreakers);
}

/**
* Creates a new instance CircuitBreakerMetrics {@link CircuitBreakerMetrics} with
* an {@link Iterable} of circuit breakers as a source.
*
* @param circuitBreakers the circuit breakers
*/
public static CircuitBreakerMetrics ofIterable(String prefix, Iterable<CircuitBreaker> circuitBreakers) {
return new CircuitBreakerMetrics(circuitBreakers, prefix);
}

@Override
public void bindTo(MeterRegistry registry) {
for (CircuitBreaker circuitBreaker : circuitBreakers) {
Expand Down

0 comments on commit a9abce7

Please sign in to comment.