@Override public T get() { T v = value.get(); if (v == null) { return defaultValue; } else { return v; } }
@Override public Number getValue() { return properties.circuitBreakerErrorThresholdPercentage().get(); } });
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Number getValue() { return properties.executionTimeoutInMilliseconds().get(); } });
@Override public Boolean getValue() { return properties.metricsRollingPercentileEnabled().get(); } });
@Override public Boolean getValue() { return properties.requestCacheEnabled().get(); } });
@Override public Boolean getValue() { return properties.requestLogEnabled().get(); } });
private boolean isAfterSleepWindow() { final long circuitOpenTime = circuitOpened.get(); final long currentTime = System.currentTimeMillis(); final long sleepWindowTime = properties.circuitBreakerSleepWindowInMilliseconds().get(); return currentTime > circuitOpenTime + sleepWindowTime; }
@Override public Number getValue() { return properties.queueSizeRejectionThreshold().get(); } });
private HystrixThreadPoolConfiguration(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { this(threadPoolKey, threadPoolProperties.coreSize().get(), threadPoolProperties.maximumSize().get(), threadPoolProperties.actualMaximumSize(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get()); }
public static CumulativeCollapserEventCounterStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(collapserKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingThreadPoolEventCounterStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingCommandLatencyDistributionStream getInstance(HystrixCommandKey commandKey, HystrixCommandProperties properties) { final int percentileMetricWindow = properties.metricsRollingPercentileWindowInMilliseconds().get(); final int numPercentileBuckets = properties.metricsRollingPercentileWindowBuckets().get(); final int percentileBucketSizeInMs = percentileMetricWindow / numPercentileBuckets; return getInstance(commandKey, numPercentileBuckets, percentileBucketSizeInMs); }
public static RollingCollapserEventCounterStream getInstance(HystrixCollapserKey collapserKey, HystrixCollapserProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(collapserKey, numCounterBuckets, counterBucketSizeInMs); }
@Override public String getValue() { return properties.executionIsolationStrategy().get().name(); } });
@Override public void call() { if (!commandIsScalar()) { long latency = System.currentTimeMillis() - executionResult.getStartTimestamp(); eventNotifier.markEvent(HystrixEventType.SUCCESS, commandKey); executionResult = executionResult.addEvent((int) latency, HystrixEventType.SUCCESS); eventNotifier.markCommandExecution(getCommandKey(), properties.executionIsolationStrategy().get(), (int) latency, executionResult.getOrderedList()); circuitBreaker.markSuccess(); } } };
@Test public void testNested3() { HystrixProperty<String> nullValue = Factory.nullProperty(); HystrixProperty<String> a = Factory.asProperty(nullValue, "a"); HystrixProperty<String> withDefault = Factory.asProperty(a, "b"); assertEquals("a", withDefault.get()); }
@Test public void testIntegerBuilderOverride() { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter().withMetricsRollingStatisticalWindowInMilliseconds(5000), "unitTestPrefix"); // the builder override should take precedence over the default assertEquals(5000, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); }
@Test public void testIntegerCodeDefault() { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter(), "unitTestPrefix"); assertEquals(HystrixCommandProperties.default_metricsRollingStatisticalWindow, properties.metricsRollingStatisticalWindowInMilliseconds().get()); }
@Test public void testIntegerInstanceBuilderOverrideOfGlobalDynamicOverride() throws Exception { HystrixCommandProperties properties = new TestPropertiesCommand(TestKey.TEST, new HystrixCommandProperties.Setter().withMetricsRollingStatisticalWindowInMilliseconds(5000), "unitTestPrefix"); ConfigurationManager.getConfigInstance().setProperty("unitTestPrefix.command.default.rollingStats.timeInMilliseconds", 3456); // the builder injected should take precedence over the global dynamic property assertEquals(5000, properties.metricsRollingStatisticalWindowInMilliseconds().get().intValue()); // cleanup ConfigurationManager.getConfigInstance().clearProperty("unitTestPrefix.command.default.rollingStats.timeInMilliseconds"); }