Search in sources :

Example 6 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project java-chassis by ServiceComb.

the class ServiceRegistryConfig method getIdleConnectionTimeout.

public int getIdleConnectionTimeout() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("cse.service.registry.client.timeout.idle", DEFAULT_TIMEOUT_IN_MS);
    int timeout = property.get();
    return timeout < TimeUnit.SECONDS.toMillis(1) ? DEFAULT_TIMEOUT_IN_MS : timeout;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 7 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project java-chassis by ServiceComb.

the class ServiceRegistryConfig method getWorkerPoolSize.

public int getWorkerPoolSize() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("cse.service.registry.client.workerPoolSize", 1);
    int workerPoolSize = property.get();
    if (workerPoolSize <= 0) {
        return Runtime.getRuntime().availableProcessors();
    }
    return workerPoolSize;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 8 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project incubator-servicecomb-java-chassis by apache.

the class DynamicPropertiesImpl method getIntProperty.

@Override
public int getIntProperty(String propertyName, IntConsumer consumer, int defaultValue) {
    DynamicIntProperty prop = propertyFactoryInstance().getIntProperty(propertyName, defaultValue);
    prop.addCallback(() -> consumer.accept(prop.get()));
    return prop.get();
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 9 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project incubator-servicecomb-java-chassis by apache.

the class ServiceRegistryConfig method getRequestTimeout.

public int getRequestTimeout() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("cse.service.registry.client.timeout.request", DEFAULT_REQUEST_TIMEOUT_IN_MS);
    int timeout = property.get();
    return timeout < 1 ? DEFAULT_REQUEST_TIMEOUT_IN_MS : timeout;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 10 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project incubator-servicecomb-java-chassis by apache.

the class ServiceRegistryConfig method getWorkerPoolSize.

public int getWorkerPoolSize() {
    String workerPoolSizeKey = "cse.service.registry.client.workerPoolSize";
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty(workerPoolSizeKey, 1);
    int workerPoolSize = property.get();
    if (workerPoolSize <= 0) {
        int nAvailableProcessors = Runtime.getRuntime().availableProcessors();
        LOGGER.warn("The property `{}` must be positive integer, fallback to use number of available processors: {}", workerPoolSizeKey, nAvailableProcessors);
        return nAvailableProcessors;
    }
    return workerPoolSize;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Aggregations

DynamicIntProperty (com.netflix.config.DynamicIntProperty)34 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 DynamicFloatProperty (com.netflix.config.DynamicFloatProperty)1 HystrixCommandProperties (com.netflix.hystrix.HystrixCommandProperties)1 ChannelConfig (com.netflix.netty.common.channel.config.ChannelConfig)1 ServerSslConfig (com.netflix.netty.common.ssl.ServerSslConfig)1 Http2SslChannelInitializer (com.netflix.zuul.netty.server.http2.Http2SslChannelInitializer)1 BaseSslContextFactory (com.netflix.zuul.netty.ssl.BaseSslContextFactory)1 SampleSSEPushChannelInitializer (com.netflix.zuul.sample.push.SampleSSEPushChannelInitializer)1 SampleWebSocketPushChannelInitializer (com.netflix.zuul.sample.push.SampleWebSocketPushChannelInitializer)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketAddress (java.net.SocketAddress)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Header (org.apache.http.Header)1 ThreadSafeClientConnManager (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager)1 BasicHeader (org.apache.http.message.BasicHeader)1 HttpParams (org.apache.http.params.HttpParams)1