public class LoadBalancerImpl<K> extends Object implements LoadBalancer<K>
RequestTracker.RequestResult| 构造器和说明 |
|---|
LoadBalancerImpl(LoadBalancingStrategy<K> strategy,
DynamicSet<K> hostSet)
Creates a new load balancer that will use the given strategy.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static <K> LoadBalancerImpl<K> |
create(LoadBalancingStrategy<K> strategy,
DynamicSet<K> hostSet)
Convenience method to create a new load balancer.
|
K |
nextBackend() |
void |
offerBackends(Set<K> offeredBackends) |
void |
requestResult(K key,
RequestTracker.RequestResult result,
long requestTimeNanos)
Informs the tracker of a completed request.
|
public LoadBalancerImpl(LoadBalancingStrategy<K> strategy, DynamicSet<K> hostSet)
strategy - Strategy to delegate load balancing work to.hostSet - public void offerBackends(Set<K> offeredBackends)
offerBackends 在接口中 LoadBalancer<K>public K nextBackend() throws ResourceExhaustedException
nextBackend 在接口中 LoadBalancer<K>ResourceExhaustedExceptionpublic void requestResult(K key, RequestTracker.RequestResult result, long requestTimeNanos)
RequestTrackerrequestResult 在接口中 RequestTracker<K>key - Key to identify the owner of the request.result - Result of the request.requestTimeNanos - Time duration spent waiting for the request to complete.public static <K> LoadBalancerImpl<K> create(LoadBalancingStrategy<K> strategy, DynamicSet<K> hostSet)
K - Backend type.strategy - Strategy to use.Copyright © 2015 Baifendian Corporation. All rights reserved.