public class RandomStrategy<S> extends Object
| 构造器和说明 |
|---|
RandomStrategy() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addConnectResult(K backendKey,
RequestTracker.RequestResult result,
long connectTimeNanos)
Offers information about a connection result.
|
S |
nextBackend()
Gets the next backend that a request should be sent to.
|
void |
offerBackends(Set<K> offeredBackends,
Closure<Collection<K>> onBackendsChosen)
Offers a set of backends that the load balancer should choose from to
distribute load amongst.
|
protected Collection<S> |
onBackendsOffered(Set<S> targets) |
protected Collection<S> onBackendsOffered(Set<S> targets)
public S nextBackend() throws ResourceExhaustedException
LoadBalancingStrategyResourceExhaustedExceptionpublic final void offerBackends(Set<K> offeredBackends, Closure<Collection<K>> onBackendsChosen)
LoadBalancingStrategyofferBackends 在接口中 LoadBalancingStrategy<K>offeredBackends - Backends to choose from.onBackendsChosen - A callback that should be notified when the offered backends
have been (re)chosen from.public void addConnectResult(K backendKey,
RequestTracker.RequestResult result,
long connectTimeNanos)
LoadBalancingStrategyaddConnectResult 在接口中 LoadBalancingStrategy<K>backendKey - Backend key.result - Connection result.connectTimeNanos - Time spent waiting for connection to be established.Copyright © 2015 Baifendian Corporation. All rights reserved.