Skip to content

Commit 2ad0baa

Browse files
authored
Merge pull request #1572 from dmgcodevil/iss1565
1565: Set maximumSize using @HystrixCommand annotation
2 parents bfa5ba0 + df5b5b3 commit 2ad0baa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ private HystrixPropertiesManager() {
7979
*/
8080
public static final String MAX_QUEUE_SIZE = "maxQueueSize";
8181
public static final String CORE_SIZE = "coreSize";
82+
public static final String MAXIMUM_SIZE = "maximumSize";
8283
public static final String KEEP_ALIVE_TIME_MINUTES = "keepAliveTimeMinutes";
8384
public static final String QUEUE_SIZE_REJECTION_THRESHOLD = "queueSizeRejectionThreshold";
8485
public static final String METRICS_ROLLING_STATS_NUM_BUCKETS = "metrics.rollingStats.numBuckets";
@@ -288,6 +289,13 @@ public void set(HystrixThreadPoolProperties.Setter setter, String value) {
288289
}
289290
}
290291
)
292+
.put(MAXIMUM_SIZE, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
293+
@Override
294+
public void set(HystrixThreadPoolProperties.Setter setter, String value) {
295+
setter.withMaximumSize(toInt(MAXIMUM_SIZE, value));
296+
}
297+
}
298+
)
291299
.put(KEEP_ALIVE_TIME_MINUTES, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
292300
@Override
293301
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

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ 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());
8788
assertEquals(101, (int) properties.maxQueueSize().get());
8889
assertEquals(2, (int) properties.keepAliveTimeMinutes().get());
8990
assertEquals(15, (int) properties.queueSizeRejectionThreshold().get());
@@ -159,6 +160,7 @@ public static class UserService {
159160
},
160161
threadPoolProperties = {
161162
@HystrixProperty(name = "coreSize", value = "30"),
163+
@HystrixProperty(name = "maximumSize", value = "25"),
162164
@HystrixProperty(name = "maxQueueSize", value = "101"),
163165
@HystrixProperty(name = "keepAliveTimeMinutes", value = "2"),
164166
@HystrixProperty(name = "metrics.rollingStats.numBuckets", value = "12"),

0 commit comments

Comments
 (0)