Search in sources :

Example 1 with RandomHash

use of com.linkedin.d2.balancer.util.hashing.RandomHash in project rest.li by linkedin.

the class DegraderLoadBalancerStrategyV3 method setConfig.

public void setConfig(DegraderLoadBalancerStrategyConfig config) {
    _config = config;
    String hashMethod = _config.getHashMethod();
    Map<String, Object> hashConfig = _config.getHashConfig();
    if (hashMethod == null || hashMethod.equals(HASH_METHOD_NONE)) {
        _hashFunction = new RandomHash();
    } else if (HASH_METHOD_URI_REGEX.equals(hashMethod)) {
        _hashFunction = new URIRegexHash(hashConfig);
    } else {
        _log.warn("Unknown hash method {}, falling back to random", hashMethod);
        _hashFunction = new RandomHash();
    }
}
Also used : URIRegexHash(com.linkedin.d2.balancer.util.hashing.URIRegexHash) RandomHash(com.linkedin.d2.balancer.util.hashing.RandomHash)

Example 2 with RandomHash

use of com.linkedin.d2.balancer.util.hashing.RandomHash in project rest.li by linkedin.

the class DegraderLoadBalancerStrategyV2_1 method setConfig.

public void setConfig(DegraderLoadBalancerStrategyConfig config) {
    _config = config;
    String hashMethod = _config.getHashMethod();
    Map<String, Object> hashConfig = _config.getHashConfig();
    if (hashMethod == null || hashMethod.equals(HASH_METHOD_NONE)) {
        _hashFunction = new RandomHash();
    } else if (HASH_METHOD_URI_REGEX.equals(hashMethod)) {
        _hashFunction = new URIRegexHash(hashConfig);
    } else {
        _log.warn("Unknown hash method {}, falling back to random", hashMethod);
        _hashFunction = new RandomHash();
    }
}
Also used : URIRegexHash(com.linkedin.d2.balancer.util.hashing.URIRegexHash) RandomHash(com.linkedin.d2.balancer.util.hashing.RandomHash)

Example 3 with RandomHash

use of com.linkedin.d2.balancer.util.hashing.RandomHash in project rest.li by linkedin.

the class DegraderLoadBalancerStrategyV2 method setConfig.

public void setConfig(DegraderLoadBalancerStrategyConfig config) {
    _config = config;
    String hashMethod = _config.getHashMethod();
    Map<String, Object> hashConfig = _config.getHashConfig();
    if (hashMethod == null || hashMethod.equals(HASH_METHOD_NONE)) {
        _hashFunction = new RandomHash();
    } else if (HASH_METHOD_URI_REGEX.equals(hashMethod)) {
        _hashFunction = new URIRegexHash(hashConfig);
    } else {
        _log.warn("Unknown hash method {}, falling back to random", hashMethod);
        _hashFunction = new RandomHash();
    }
}
Also used : URIRegexHash(com.linkedin.d2.balancer.util.hashing.URIRegexHash) RandomHash(com.linkedin.d2.balancer.util.hashing.RandomHash)

Aggregations

RandomHash (com.linkedin.d2.balancer.util.hashing.RandomHash)3 URIRegexHash (com.linkedin.d2.balancer.util.hashing.URIRegexHash)3