diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java index 77d485c73..140b86504 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPool.java @@ -174,7 +174,7 @@ public HystrixThreadPoolDefault(HystrixThreadPoolKey threadPoolKey, HystrixThrea this.queueSize = properties.maxQueueSize().get(); this.queue = concurrencyStrategy.getBlockingQueue(queueSize); - if (properties.getAllowMaximumSizeToDivergeFromCoreSize()) { + if (properties.getAllowMaximumSizeToDivergeFromCoreSize().get()) { this.metrics = HystrixThreadPoolMetrics.getInstance(threadPoolKey, concurrencyStrategy.getThreadPool(threadPoolKey, properties.coreSize(), properties.maximumSize(), properties.keepAliveTimeMinutes(), TimeUnit.MINUTES, queue), properties); @@ -218,7 +218,7 @@ private void touchConfig() { final int dynamicCoreSize = properties.coreSize().get(); final int dynamicMaximumSize = properties.maximumSize().get(); int updatedMaximumSize = dynamicMaximumSize; - final boolean allowSizesToDiverge = properties.getAllowMaximumSizeToDivergeFromCoreSize(); + final boolean allowSizesToDiverge = properties.getAllowMaximumSizeToDivergeFromCoreSize().get(); boolean maxTooLow = false; if (allowSizesToDiverge && dynamicMaximumSize < dynamicCoreSize) { diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java index eb719337b..bc1f154be 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/HystrixThreadPoolProperties.java @@ -63,7 +63,7 @@ public abstract class HystrixThreadPoolProperties { private final HystrixProperty keepAliveTime; private final HystrixProperty maxQueueSize; private final HystrixProperty queueSizeRejectionThreshold; - private final boolean allowMaximumSizeToDivergeFromCoreSize; + private final HystrixProperty allowMaximumSizeToDivergeFromCoreSize; private final HystrixProperty threadPoolRollingNumberStatisticalWindowInMilliseconds; private final HystrixProperty threadPoolRollingNumberStatisticalWindowBuckets; @@ -77,7 +77,7 @@ protected HystrixThreadPoolProperties(HystrixThreadPoolKey key, Setter builder) } protected HystrixThreadPoolProperties(HystrixThreadPoolKey key, Setter builder, String propertyPrefix) { - this.allowMaximumSizeToDivergeFromCoreSize = getValueOnce(propertyPrefix, key, "allowMaximumSizeToDivergeFromCoreSize", + this.allowMaximumSizeToDivergeFromCoreSize = getProperty(propertyPrefix, key, "allowMaximumSizeToDivergeFromCoreSize", builder.getAllowMaximumSizeToDivergeFromCoreSize(), default_allow_maximum_size_to_diverge_from_core_size); this.corePoolSize = getProperty(propertyPrefix, key, "coreSize", builder.getCoreSize(), default_coreSize); @@ -99,12 +99,11 @@ private static HystrixProperty getProperty(String propertyPrefix, Hystr .build(); } - private static boolean getValueOnce(String propertyPrefix, HystrixThreadPoolKey key, String instanceProperty, boolean builderOverrideValue, boolean defaultValue) { + private static HystrixProperty getProperty(String propertyPrefix, HystrixThreadPoolKey key, String instanceProperty, Boolean builderOverrideValue, Boolean defaultValue) { return forBoolean() .add(propertyPrefix + ".threadpool." + key.name() + "." + instanceProperty, builderOverrideValue) .add(propertyPrefix + ".threadpool.default." + instanceProperty, defaultValue) - .build() - .get(); + .build(); } /** @@ -158,7 +157,7 @@ public HystrixProperty queueSizeRejectionThreshold() { return queueSizeRejectionThreshold; } - public boolean getAllowMaximumSizeToDivergeFromCoreSize() { + public HystrixProperty getAllowMaximumSizeToDivergeFromCoreSize() { return allowMaximumSizeToDivergeFromCoreSize; } @@ -218,7 +217,7 @@ public static class Setter { private Integer keepAliveTimeMinutes = null; private Integer maxQueueSize = null; private Integer queueSizeRejectionThreshold = null; - private boolean allowMaximumSizeToDivergeFromCoreSize = false; + private Boolean allowMaximumSizeToDivergeFromCoreSize = null; private Integer rollingStatisticalWindowInMilliseconds = null; private Integer rollingStatisticalWindowBuckets = null; @@ -245,7 +244,7 @@ public Integer getQueueSizeRejectionThreshold() { return queueSizeRejectionThreshold; } - public boolean getAllowMaximumSizeToDivergeFromCoreSize() { + public Boolean getAllowMaximumSizeToDivergeFromCoreSize() { return allowMaximumSizeToDivergeFromCoreSize; } diff --git a/hystrix-core/src/main/java/com/netflix/hystrix/config/HystrixThreadPoolConfiguration.java b/hystrix-core/src/main/java/com/netflix/hystrix/config/HystrixThreadPoolConfiguration.java index 19c8c3996..f7b57aee8 100644 --- a/hystrix-core/src/main/java/com/netflix/hystrix/config/HystrixThreadPoolConfiguration.java +++ b/hystrix-core/src/main/java/com/netflix/hystrix/config/HystrixThreadPoolConfiguration.java @@ -53,7 +53,7 @@ public static HystrixThreadPoolConfiguration sample(HystrixThreadPoolKey threadP threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.keepAliveTimeMinutes().get(), - threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize(), + threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get()); }