Skip to content

Commit

Permalink
1565: Set maximumSize using @HystrixCommand annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgcodevil committed May 9, 2017
1 parent fefdc37 commit df5b5b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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 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";
Expand Down Expand Up @@ -288,6 +289,13 @@ public void set(HystrixThreadPoolProperties.Setter setter, String value) {
}
}
)
.put(MAXIMUM_SIZE, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
@Override
public void set(HystrixThreadPoolProperties.Setter setter, String value) {
setter.withMaximumSize(toInt(MAXIMUM_SIZE, value));
}
}
)
.put(KEEP_ALIVE_TIME_MINUTES, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
@Override
public void set(HystrixThreadPoolProperties.Setter setter, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public void testGetUser() throws NoSuchFieldException, IllegalAccessException {
HystrixThreadPoolProperties properties = getThreadPoolProperties(command);

assertEquals(30, (int) properties.coreSize().get());
assertEquals(25, (int) properties.maximumSize().get());
assertEquals(101, (int) properties.maxQueueSize().get());
assertEquals(2, (int) properties.keepAliveTimeMinutes().get());
assertEquals(15, (int) properties.queueSizeRejectionThreshold().get());
Expand Down Expand Up @@ -159,6 +160,7 @@ public static class UserService {
},
threadPoolProperties = {
@HystrixProperty(name = "coreSize", value = "30"),
@HystrixProperty(name = "maximumSize", value = "25"),
@HystrixProperty(name = "maxQueueSize", value = "101"),
@HystrixProperty(name = "keepAliveTimeMinutes", value = "2"),
@HystrixProperty(name = "metrics.rollingStats.numBuckets", value = "12"),
Expand Down

0 comments on commit df5b5b3

Please sign in to comment.