use of com.netflix.dyno.connectionpool.impl.lb.HostToken in project kork by spinnaker.
the class DynomiteDriverProperties method getDynoHostTokens.
public List<HostToken> getDynoHostTokens() {
List<HostToken> tokens = new ArrayList<>();
List<Host> dynoHosts = getDynoHosts();
for (int i = 0; i < dynoHosts.size(); i++) {
tokens.add(new HostToken(hosts.get(i).token, dynoHosts.get(i)));
}
return tokens;
}
use of com.netflix.dyno.connectionpool.impl.lb.HostToken in project conductor by Netflix.
the class TokenMapSupplierProvider method get.
@Override
public TokenMapSupplier get() {
return new TokenMapSupplier() {
@Override
public List<HostToken> getTokens(Set<Host> activeHosts) {
long i = activeHosts.size();
for (Host host : activeHosts) {
HostToken hostToken = new HostToken(i, host);
hostTokens.add(hostToken);
i--;
}
return hostTokens;
}
@Override
public HostToken getTokenForHost(Host host, Set<Host> activeHosts) {
return CollectionUtils.find(hostTokens, token -> token.getHost().compareTo(host) == 0);
}
};
}
Aggregations