Java Code Examples for com.netflix.client.config.IClientConfig#getGlobalProperty()
The following examples show how to use
com.netflix.client.config.IClientConfig#getGlobalProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoadBalancerStats.java From ribbon with Apache License 2.0 | 6 votes |
@Override public void initWithNiwsConfig(IClientConfig clientConfig) { this.name = clientConfig.getClientName(); Preconditions.checkArgument(name != null, "IClientConfig#getCLientName() must not be null"); this.connectionFailureThreshold = new UnboxedIntProperty( clientConfig.getGlobalProperty(CONNECTION_FAILURE_COUNT_THRESHOLD.format(name)) .fallbackWith(clientConfig.getGlobalProperty(DEFAULT_CONNECTION_FAILURE_COUNT_THRESHOLD)) ); this.circuitTrippedTimeoutFactor = new UnboxedIntProperty( clientConfig.getGlobalProperty(CIRCUIT_TRIP_TIMEOUT_FACTOR_SECONDS.format(name)) .fallbackWith(clientConfig.getGlobalProperty(DEFAULT_CIRCUIT_TRIP_TIMEOUT_FACTOR_SECONDS)) ); this.maxCircuitTrippedTimeout = new UnboxedIntProperty( clientConfig.getGlobalProperty(CIRCUIT_TRIP_MAX_TIMEOUT_SECONDS.format(name)) .fallbackWith(clientConfig.getGlobalProperty(DEFAULT_CIRCUIT_TRIP_MAX_TIMEOUT_SECONDS)) ); this.activeRequestsCountTimeout = new UnboxedIntProperty( clientConfig.getGlobalProperty(ACTIVE_REQUESTS_COUNT_TIMEOUT)); }
Example 2
Source File: NFHttpClient.java From ribbon with Apache License 2.0 | 5 votes |
void init(IClientConfig config, boolean registerMonitor) { HttpParams params = getParams(); HttpProtocolParams.setContentCharset(params, "UTF-8"); params.setParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME, ThreadSafeClientConnManager.class.getName()); HttpClientParams.setRedirecting(params, config.get(CommonClientConfigKey.FollowRedirects, true)); // set up default headers List<Header> defaultHeaders = new ArrayList<Header>(); defaultHeaders.add(new BasicHeader("Netflix.NFHttpClient.Version", "1.0")); defaultHeaders.add(new BasicHeader("X-netflix-httpclientname", name)); params.setParameter(ClientPNames.DEFAULT_HEADERS, defaultHeaders); connPoolCleaner = new ConnectionPoolCleaner(name, this.getConnectionManager(), connectionPoolCleanUpScheduler); this.retriesProperty = config.getGlobalProperty(RETRIES.format(name)); this.sleepTimeFactorMsProperty = config.getGlobalProperty(SLEEP_TIME_FACTOR_MS.format(name)); setHttpRequestRetryHandler( new NFHttpMethodRetryHandler(this.name, this.retriesProperty.getOrDefault(), false, this.sleepTimeFactorMsProperty.getOrDefault())); tracer = Monitors.newTimer(EXECUTE_TRACER + "-" + name, TimeUnit.MILLISECONDS); if (registerMonitor) { Monitors.registerObject(name, this); } maxTotalConnectionProperty = config.getDynamicProperty(CommonClientConfigKey.MaxTotalHttpConnections); maxTotalConnectionProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setMaxTotal(newValue) ); maxConnectionPerHostProperty = config.getDynamicProperty(CommonClientConfigKey.MaxHttpConnectionsPerHost); maxConnectionPerHostProperty.onChange(newValue -> ((ThreadSafeClientConnManager) getConnectionManager()).setDefaultMaxPerRoute(newValue) ); connIdleEvictTimeMilliSeconds = config.getGlobalProperty(CONN_IDLE_EVICT_TIME_MILLIS.format(name)); }
Example 3
Source File: ZoneAwareLoadBalancer.java From ribbon with Apache License 2.0 | 5 votes |
@Deprecated public ZoneAwareLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, ServerList<T> serverList, ServerListFilter<T> filter) { super(clientConfig, rule, ping, serverList, filter); String name = Optional.ofNullable(getName()).orElse("default"); this.enabled = clientConfig.getGlobalProperty(ENABLED); this.triggeringLoad = clientConfig.getGlobalProperty(TRIGGERING_LOAD_PER_SERVER_THRESHOLD.format(name)); this.triggeringBlackoutPercentage = clientConfig.getGlobalProperty(AVOID_ZONE_WITH_BLACKOUT_PERCENTAGE.format(name)); }
Example 4
Source File: ZoneAwareLoadBalancer.java From ribbon with Apache License 2.0 | 5 votes |
public ZoneAwareLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, ServerList<T> serverList, ServerListFilter<T> filter, ServerListUpdater serverListUpdater) { super(clientConfig, rule, ping, serverList, filter, serverListUpdater); String name = Optional.ofNullable(getName()).orElse("default"); this.enabled = clientConfig.getGlobalProperty(ENABLED); this.triggeringLoad = clientConfig.getGlobalProperty(TRIGGERING_LOAD_PER_SERVER_THRESHOLD.format(name)); this.triggeringBlackoutPercentage = clientConfig.getGlobalProperty(AVOID_ZONE_WITH_BLACKOUT_PERCENTAGE.format(name)); }
Example 5
Source File: ZoneAwareLoadBalancer.java From ribbon with Apache License 2.0 | 5 votes |
@Override public void initWithNiwsConfig(IClientConfig clientConfig) { super.initWithNiwsConfig(clientConfig); String name = Optional.ofNullable(getName()).orElse("default"); this.enabled = clientConfig.getGlobalProperty(ENABLED); this.triggeringLoad = clientConfig.getGlobalProperty(TRIGGERING_LOAD_PER_SERVER_THRESHOLD.format(name)); this.triggeringBlackoutPercentage = clientConfig.getGlobalProperty(AVOID_ZONE_WITH_BLACKOUT_PERCENTAGE.format(name)); }
Example 6
Source File: ZoneAvoidancePredicate.java From ribbon with Apache License 2.0 | 5 votes |
private void initDynamicProperties(IClientConfig clientConfig) { if (clientConfig != null) { enabled = clientConfig.getGlobalProperty(ENABLED); triggeringLoad = clientConfig.getGlobalProperty(TRIGGERING_LOAD_PER_SERVER_THRESHOLD.format(clientConfig.getClientName())); triggeringBlackoutPercentage = clientConfig.getGlobalProperty(AVOID_ZONE_WITH_BLACKOUT_PERCENTAGE.format(clientConfig.getClientName())); } }
Example 7
Source File: AvailabilityPredicate.java From ribbon with Apache License 2.0 | 5 votes |
private void initDynamicProperty(IClientConfig clientConfig) { if (clientConfig != null) { this.circuitBreakerFiltering = clientConfig.getGlobalProperty(FILTER_CIRCUIT_TRIPPED); this.defaultActiveConnectionsLimit = clientConfig.getGlobalProperty(DEFAULT_ACTIVE_CONNECTIONS_LIMIT); this.activeConnectionsLimit = clientConfig.getDynamicProperty(ACTIVE_CONNECTIONS_LIMIT); } }