Skip to content

Commit

Permalink
Merge pull request #1584 from mattrjacobs/add-javanica-support-for-al…
Browse files Browse the repository at this point in the history
…low-maximum-size-to-diverge-from-core-size

Added Javanica support for setting allowMaximumSizeToDivergeFromCoreSize in an annotation
  • Loading branch information
mattrjacobs authored May 16, 2017
2 parents 4262904 + 717f13b commit 338aadc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -296,6 +297,12 @@ public void set(HystrixThreadPoolProperties.Setter setter, String value) {
}
}
)
.put(ALLOW_MAXIMUM_SIZE_TO_DIVERGE_FROM_CORE_SIZE, new PropSetter<HystrixThreadPoolProperties.Setter, String>() {
@Override
public void set(HystrixThreadPoolProperties.Setter setter, String value) throws IllegalArgumentException {
setter.withAllowMaximumSizeToDivergeFromCoreSize(toBoolean(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,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());
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 338aadc

Please sign in to comment.