Skip to content

Commit 338aadc

Browse files
authored
Merge pull request #1584 from mattrjacobs/add-javanica-support-for-allow-maximum-size-to-diverge-from-core-size
Added Javanica support for setting allowMaximumSizeToDivergeFromCoreSize in an annotation
2 parents 4262904 + 717f13b commit 338aadc

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private HystrixPropertiesManager() {
8080
public static final String MAX_QUEUE_SIZE = "maxQueueSize";
8181
public static final String CORE_SIZE = "coreSize";
8282
public static final String MAXIMUM_SIZE = "maximumSize";
83+
public static final String ALLOW_MAXIMUM_SIZE_TO_DIVERGE_FROM_CORE_SIZE = "allowMaximumSizeToDivergeFromCoreSize";
8384
public static final String KEEP_ALIVE_TIME_MINUTES = "keepAliveTimeMinutes";
8485
public static final String QUEUE_SIZE_REJECTION_THRESHOLD = "queueSizeRejectionThreshold";
8586
public static final String METRICS_ROLLING_STATS_NUM_BUCKETS = "metrics.rollingStats.numBuckets";
@@ -296,6 +297,12 @@ public void set(HystrixThreadPoolProperties.Setter setter, String value) {
296297
}
297298
}
298299
)
300+
.put(ALLOW_MAXIMUM_SIZE_TO_DIVERGE_FROM_CORE_SIZE, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
301+
@Override
302+
public void set(HystrixThreadPoolProperties.Setter setter, String value) throws IllegalArgumentException {
303+
setter.withAllowMaximumSizeToDivergeFromCoreSize(toBoolean(value));
304+
}
305+
})
299306
.put(KEEP_ALIVE_TIME_MINUTES, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
300307
@Override
301308
public void set(HystrixThreadPoolProperties.Setter setter, String value) {

hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/common/configuration/command/BasicCommandPropertiesTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public void testGetUser() throws NoSuchFieldException, IllegalAccessException {
8484
HystrixThreadPoolProperties properties = getThreadPoolProperties(command);
8585

8686
assertEquals(30, (int) properties.coreSize().get());
87-
assertEquals(25, (int) properties.maximumSize().get());
87+
assertEquals(35, (int) properties.maximumSize().get());
88+
assertEquals(true, properties.getAllowMaximumSizeToDivergeFromCoreSize().get());
8889
assertEquals(101, (int) properties.maxQueueSize().get());
8990
assertEquals(2, (int) properties.keepAliveTimeMinutes().get());
9091
assertEquals(15, (int) properties.queueSizeRejectionThreshold().get());
@@ -160,7 +161,8 @@ public static class UserService {
160161
},
161162
threadPoolProperties = {
162163
@HystrixProperty(name = "coreSize", value = "30"),
163-
@HystrixProperty(name = "maximumSize", value = "25"),
164+
@HystrixProperty(name = "maximumSize", value = "35"),
165+
@HystrixProperty(name = "allowMaximumSizeToDivergeFromCoreSize", value = "true"),
164166
@HystrixProperty(name = "maxQueueSize", value = "101"),
165167
@HystrixProperty(name = "keepAliveTimeMinutes", value = "2"),
166168
@HystrixProperty(name = "metrics.rollingStats.numBuckets", value = "12"),

0 commit comments

Comments
 (0)