Search in sources :

Example 1 with IClientConfigKey

use of com.netflix.client.config.IClientConfigKey in project camel by apache.

the class RibbonLoadBalancer method createLoadBalancer.

// ************************
// Helpers
// ************************
private ZoneAwareLoadBalancer<RibbonServiceDefinition> createLoadBalancer(String serviceName, ServiceDiscovery serviceDiscovery) {
    // setup client config
    IClientConfig config = configuration.getClientName() != null ? IClientConfig.Builder.newBuilder(configuration.getClientName()).build() : IClientConfig.Builder.newBuilder().build();
    if (configuration.getClientConfig() != null) {
        for (Map.Entry<String, String> entry : configuration.getClientConfig().entrySet()) {
            IClientConfigKey key = IClientConfigKey.Keys.valueOf(entry.getKey());
            String value = entry.getValue();
            LOGGER.debug("RibbonClientConfig: {}={}", key.key(), value);
            config.set(key, value);
        }
    }
    return new ZoneAwareLoadBalancer<>(config, configuration.getRuleOrDefault(RoundRobinRule::new), configuration.getPingOrDefault(DummyPing::new), new RibbonServerList(serviceName, serviceDiscovery, serviceFilter), null, new PollingServerListUpdater(config));
}
Also used : PollingServerListUpdater(com.netflix.loadbalancer.PollingServerListUpdater) IClientConfig(com.netflix.client.config.IClientConfig) ZoneAwareLoadBalancer(com.netflix.loadbalancer.ZoneAwareLoadBalancer) IClientConfigKey(com.netflix.client.config.IClientConfigKey) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with IClientConfigKey

use of com.netflix.client.config.IClientConfigKey in project ribbon by Netflix.

the class ExecutionContextListenerInvoker method isListenerDisabled.

private boolean isListenerDisabled(ExecutionListener<?, ?> listener) {
    if (clientConfig == null) {
        return false;
    } else {
        String className = listener.getClass().getName();
        IClientConfigKey key = classConfigKeyMap.get(className);
        if (key == null) {
            key = CommonClientConfigKey.valueOf("listener." + className + ".disabled");
            IClientConfigKey old = classConfigKeyMap.putIfAbsent(className, key);
            if (old != null) {
                key = old;
            }
        }
        return clientConfig.getPropertyAsBoolean(key, false);
    }
}
Also used : IClientConfigKey(com.netflix.client.config.IClientConfigKey)

Aggregations

IClientConfigKey (com.netflix.client.config.IClientConfigKey)2 IClientConfig (com.netflix.client.config.IClientConfig)1 PollingServerListUpdater (com.netflix.loadbalancer.PollingServerListUpdater)1 ZoneAwareLoadBalancer (com.netflix.loadbalancer.ZoneAwareLoadBalancer)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1