Search in sources :

Example 16 with DynamicIntProperty

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

the class ServiceRegistryConfigBuilder method getConnectionTimeout.

public int getConnectionTimeout() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("servicecomb.service.registry.client.timeout.connection", 1000);
    int timeout = property.get();
    return timeout < 0 ? 1000 : timeout;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 17 with DynamicIntProperty

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

the class ServiceRegistryConfigBuilder method getHeartbeatInterval.

public int getHeartbeatInterval() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("servicecomb.service.registry.instance.healthCheck.interval", ServiceRegistryConfig.DEFAULT_CHECK_INTERVAL_IN_S);
    int interval = property.get();
    return interval < 0 ? ServiceRegistryConfig.DEFAULT_CHECK_INTERVAL_IN_S : interval;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 18 with DynamicIntProperty

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

the class ServiceRegistryConfigBuilder method getResendHeartBeatTimes.

public int getResendHeartBeatTimes() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty("servicecomb.service.registry.instance.healthCheck.times", ServiceRegistryConfig.DEFAULT_CHECK_TIMES);
    int times = property.get();
    return times < 0 ? ServiceRegistryConfig.DEFAULT_CHECK_TIMES : times;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 19 with DynamicIntProperty

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

the class ServiceRegistryConfigBuilder method getInstances.

public int getInstances() {
    DynamicIntProperty property = DynamicPropertyFactory.getInstance().getIntProperty(ServiceRegistryConfig.VERTICLE_INSTANCES, 1);
    int deployInstances = property.get();
    if (deployInstances <= 0) {
        int nAvailableProcessors = Runtime.getRuntime().availableProcessors();
        LOGGER.warn("The property `{}` must be positive integer, fallback to use number of available processors: {}", ServiceRegistryConfig.VERTICLE_INSTANCES, nAvailableProcessors);
        return nAvailableProcessors;
    }
    return deployInstances;
}
Also used : DynamicIntProperty(com.netflix.config.DynamicIntProperty)

Example 20 with DynamicIntProperty

use of com.netflix.config.DynamicIntProperty in project zuul by Netflix.

the class BaseServerStartup method chooseIntChannelProperty.

/**
 * First looks for a property specific to the named listen address of the form -
 * "server.${addrName}.${propertySuffix}". If none found, then looks for a server-wide property of the form -
 * "server.${propertySuffix}".  If that is also not found, then returns the specified default value.
 */
public static int chooseIntChannelProperty(String listenAddressName, String propertySuffix, int defaultValue) {
    String globalPropertyName = "server." + propertySuffix;
    String listenAddressPropertyName = "server." + listenAddressName + "." + propertySuffix;
    Integer value = new DynamicIntProperty(listenAddressPropertyName, -999).get();
    if (value == -999) {
        value = new DynamicIntProperty(globalPropertyName, -999).get();
        if (value == -999) {
            value = defaultValue;
        }
    }
    return value;
}
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