use of com.linkedin.d2.balancer.LastSeenBalancerWithFacilitiesFactory in project rest.li by linkedin.
the class SharedZkConnectionProviderTest method getD2Client.
/**
* Obtain the d2client with the same setup.
*/
private D2Client getD2Client(Map<String, TransportClientFactory> transportClientFactoryMap) {
ZKConnectionBuilder connectionBuilder = new ZKConnectionBuilder("localhost:" + ZK_PORT);
connectionBuilder.setTimeout(ZK_TIMEOUT);
ZKPersistentConnection zkConnectionToUse = _provider.getZKPersistentConnection(connectionBuilder);
D2ClientBuilder d2ClientBuilder = new D2ClientBuilder();
d2ClientBuilder.setZkHosts("localhost:" + ZK_PORT).setZkSessionTimeout(ZK_TIMEOUT, TimeUnit.MILLISECONDS).setZKConnectionForloadBalancer(zkConnectionToUse).setLoadBalancerWithFacilitiesFactory(new LastSeenBalancerWithFacilitiesFactory()).setClientFactories(transportClientFactoryMap);
return d2ClientBuilder.build();
}
Aggregations