diff --git a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java index 040277696..eb9296ae6 100644 --- a/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java +++ b/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java @@ -80,6 +80,7 @@ private HystrixPropertiesManager() { public static final String MAX_QUEUE_SIZE = "maxQueueSize"; public static final String CORE_SIZE = "coreSize"; public static final String MAXIMUM_SIZE = "maximumSize"; + public static final String ALLOW_MAXIMUM_SIZE_TO_DIVERGE_FROM_CORE_SIZE = "allowMaximumSizeToDivergeFromCoreSize"; public static final String KEEP_ALIVE_TIME_MINUTES = "keepAliveTimeMinutes"; public static final String QUEUE_SIZE_REJECTION_THRESHOLD = "queueSizeRejectionThreshold"; public static final String METRICS_ROLLING_STATS_NUM_BUCKETS = "metrics.rollingStats.numBuckets"; @@ -296,6 +297,12 @@ public void set(HystrixThreadPoolProperties.Setter setter, String value) { } } ) + .put(ALLOW_MAXIMUM_SIZE_TO_DIVERGE_FROM_CORE_SIZE, new PropSetter() { + @Override + public void set(HystrixThreadPoolProperties.Setter setter, String value) throws IllegalArgumentException { + setter.withAllowMaximumSizeToDivergeFromCoreSize(toBoolean(value)); + } + }) .put(KEEP_ALIVE_TIME_MINUTES, new PropSetter() { @Override public void set(HystrixThreadPoolProperties.Setter setter, String value) { diff --git a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java index a1df10720..f3f4aff22 100644 --- a/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java +++ b/hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java @@ -84,7 +84,8 @@ public void testGetUser() throws NoSuchFieldException, IllegalAccessException { HystrixThreadPoolProperties properties = getThreadPoolProperties(command); assertEquals(30, (int) properties.coreSize().get()); - assertEquals(25, (int) properties.maximumSize().get()); + assertEquals(35, (int) properties.maximumSize().get()); + assertEquals(true, properties.getAllowMaximumSizeToDivergeFromCoreSize().get()); assertEquals(101, (int) properties.maxQueueSize().get()); assertEquals(2, (int) properties.keepAliveTimeMinutes().get()); assertEquals(15, (int) properties.queueSizeRejectionThreshold().get()); @@ -160,7 +161,8 @@ public static class UserService { }, threadPoolProperties = { @HystrixProperty(name = "coreSize", value = "30"), - @HystrixProperty(name = "maximumSize", value = "25"), + @HystrixProperty(name = "maximumSize", value = "35"), + @HystrixProperty(name = "allowMaximumSizeToDivergeFromCoreSize", value = "true"), @HystrixProperty(name = "maxQueueSize", value = "101"), @HystrixProperty(name = "keepAliveTimeMinutes", value = "2"), @HystrixProperty(name = "metrics.rollingStats.numBuckets", value = "12"),