use of com.netflix.config.DynamicLongProperty in project incubator-servicecomb-java-chassis by apache.
the class DynamicPropertiesImpl method getLongProperty.
@Override
public long getLongProperty(String propertyName, LongConsumer consumer, long defaultValue) {
DynamicLongProperty prop = propertyFactoryInstance().getLongProperty(propertyName, defaultValue);
prop.addCallback(() -> consumer.accept(prop.get()));
return prop.get();
}
use of com.netflix.config.DynamicLongProperty in project incubator-servicecomb-java-chassis by apache.
the class HighwayClient method createTcpClientConfig.
private TcpClientConfig createTcpClientConfig() {
TcpClientConfig tcpClientConfig = new TcpClientConfig();
DynamicLongProperty prop = AbstractTransport.getRequestTimeoutProperty();
prop.addCallback(new Runnable() {
public void run() {
tcpClientConfig.setRequestTimeoutMillis(prop.get());
}
});
tcpClientConfig.setRequestTimeoutMillis(prop.get());
SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(SSL_KEY, null);
SSLOption sslOption;
if (factory == null) {
sslOption = SSLOption.buildFromYaml(SSL_KEY);
} else {
sslOption = factory.createSSLOption();
}
SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass());
VertxTLSBuilder.buildClientOptionsBase(sslOption, sslCustom, tcpClientConfig);
return tcpClientConfig;
}
use of com.netflix.config.DynamicLongProperty in project java-chassis by ServiceComb.
the class DynamicPropertiesImpl method getLongProperty.
@Override
public long getLongProperty(String propertyName, LongConsumer consumer, long defaultValue) {
DynamicLongProperty prop = propertyFactoryInstance().getLongProperty(propertyName, defaultValue);
prop.addCallback(() -> consumer.accept(prop.get()));
return prop.get();
}
use of com.netflix.config.DynamicLongProperty in project wildfly-swarm by wildfly-swarm.
the class SyncCircuitBreakerDisabledTest method testDefaultHystrixCircuitBreakerUsed.
@Test
public void testDefaultHystrixCircuitBreakerUsed() throws InterruptedException {
// Verify Hystrix config first
DynamicLongProperty intervalInMilliseconds = DynamicPropertyFactory.getInstance().getLongProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", 500);
assertEquals(intervalInMilliseconds.get(), 10);
// CLOSED
for (int i = 0; i < ShakyServiceClient.REQUEST_THRESHOLD; i++) {
assertInvocation(false);
}
// Should be OPEN now
HystrixCircuitBreaker breaker = HystrixCircuitBreaker.Factory.getInstance(HystrixCommandKey.Factory.asKey(getCommandKey()));
assertNotNull(breaker);
assertFalse(breaker.getClass().getName().contains("org.wildfly.swarm.microprofile.faulttolerance"));
assertTrue(breaker.isOpen());
assertInvocation(true);
TimeUnit.MILLISECONDS.sleep(ShakyServiceClient.DELAY);
// Should be HALF-OPEN
assertInvocation(false);
// OPEN again
assertInvocation(true);
}
use of com.netflix.config.DynamicLongProperty in project chassis by Kixeye.
the class ChassisConfigPropertiesTest method testBasicProperty.
@Test
public void testBasicProperty() {
DynamicLongProperty dynamicLongProperty = DynamicPropertyFactory.getInstance().getLongProperty("com.kixeye.platform.chassis.testLong", -1);
assertEquals(42, dynamicLongProperty.get());
}
Aggregations