K - the key typepublic final class KeyedCircuitBreakerMapping<K> extends Object implements CircuitBreakerMapping
CircuitBreakerMapping that binds a CircuitBreaker to its key. KeyedCircuitBreakerMapping.KeySelector is used
to resolve the key from a Request. If there is no circuit breaker bound to the key, a new one is
created by using the given circuit breaker factory.| Modifier and Type | Class and Description |
|---|---|
static interface |
KeyedCircuitBreakerMapping.KeySelector<K>
Returns the mapping key of the given
Request. |
| Constructor and Description |
|---|
KeyedCircuitBreakerMapping(KeyedCircuitBreakerMapping.KeySelector<K> keySelector,
Function<K,CircuitBreaker> factory)
Creates a new
KeyedCircuitBreakerMapping with the given KeyedCircuitBreakerMapping.KeySelector and
CircuitBreaker factory. |
| Modifier and Type | Method and Description |
|---|---|
CircuitBreaker |
get(ClientRequestContext ctx,
Request req)
Returns the
CircuitBreaker mapped to the given parameters. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitofDefault, perHost, perHostAndMethod, perMethodpublic KeyedCircuitBreakerMapping(KeyedCircuitBreakerMapping.KeySelector<K> keySelector, Function<K,CircuitBreaker> factory)
KeyedCircuitBreakerMapping with the given KeyedCircuitBreakerMapping.KeySelector and
CircuitBreaker factory.keySelector - A function that returns the key of the given Request.factory - A function that takes a key and creates a new CircuitBreaker for the key.public CircuitBreaker get(ClientRequestContext ctx, Request req) throws Exception
CircuitBreakerMappingCircuitBreaker mapped to the given parameters.get in interface CircuitBreakerMappingExceptionCopyright © 2020 LeanCloud. All rights reserved.