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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations