Skip to content

Commit 50859ff

Browse files
committed
Merge pull request #675 from mattrjacobs/revert-timeout-property-name-change
Revert timeout property name change
2 parents 584340f + 727cbeb commit 50859ff

File tree

20 files changed

+66
-72
lines changed

20 files changed

+66
-72
lines changed

hystrix-contrib/hystrix-codahale-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/codahalemetricspublisher/HystrixCodaHaleMetricsPublisherCommand.java

-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ public Boolean getValue() {
256256
return properties.circuitBreakerForceClosed().get();
257257
}
258258
});
259-
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
260259
metricRegistry.register(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
261260
@Override
262261
public Number getValue() {

hystrix-contrib/hystrix-javanica/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ Command properties can be set using @HystrixCommand's 'commandProperties' like b
343343

344344
```java
345345
@HystrixCommand(commandProperties = {
346-
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "500")
346+
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500")
347347
})
348348
public User getUserById(String id) {
349349
return userResource.getUserById(id);
@@ -353,15 +353,15 @@ Command properties can be set using @HystrixCommand's 'commandProperties' like b
353353
Javanica dynamically sets properties using Hystrix ConfigurationManager.
354354
For the example above Javanica behind the scenes performs next action:
355355
```java
356-
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.getUserById.execution.timeoutInMilliseconds", "500");
356+
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.getUserById.execution.isolation.thread.timeoutInMilliseconds", "500");
357357
```
358358
More about Hystrix command properties [command](https://github.com/Netflix/Hystrix/wiki/Configuration#wiki-CommandExecution) and [fallback](https://github.com/Netflix/Hystrix/wiki/Configuration#wiki-CommandFallback)
359359

360360
ThreadPoolProperties can be set using @HystrixCommand's 'threadPoolProperties' like below:
361361

362362
```java
363363
@HystrixCommand(commandProperties = {
364-
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "500")
364+
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500")
365365
},
366366
threadPoolProperties = {
367367
@HystrixProperty(name = "coreSize", value = "30"),

hystrix-contrib/hystrix-javanica/src/test/java/com/netflix/hystrix/contrib/javanica/test/spring/configuration/command/CommandPropertiesTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static class UserService {
105105

106106
@HystrixCommand(commandKey = "GetUserCommand", groupKey = "UserGroupKey", threadPoolKey = "Test",
107107
commandProperties = {
108-
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "110"),
108+
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "110"),
109109
@HystrixProperty(name = "execution.isolation.thread.interruptOnTimeout", value = "false")
110110
},
111111
threadPoolProperties = {

hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsPoller.java

-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ private String getCommandJson(HystrixCommandMetrics commandMetrics) throws IOExc
260260
json.writeBooleanField("propertyValue_circuitBreakerEnabled", commandProperties.circuitBreakerEnabled().get());
261261

262262
json.writeStringField("propertyValue_executionIsolationStrategy", commandProperties.executionIsolationStrategy().get().name());
263-
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
264263
json.writeNumberField("propertyValue_executionIsolationThreadTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
265264
json.writeNumberField("propertyValue_executionTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
266265
json.writeBooleanField("propertyValue_executionIsolationThreadInterruptOnTimeout", commandProperties.executionIsolationThreadInterruptOnTimeout().get());

hystrix-contrib/hystrix-rx-netty-metrics-stream/src/main/java/com/netflix/hystrix/contrib/rxnetty/metricsstream/JsonMappers.java

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ static String toJson(HystrixCommandMetrics commandMetrics) throws IOException {
124124
json.writeBooleanField("propertyValue_circuitBreakerEnabled", commandProperties.circuitBreakerEnabled().get());
125125

126126
json.writeStringField("propertyValue_executionIsolationStrategy", commandProperties.executionIsolationStrategy().get().name());
127-
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
128127
json.writeNumberField("propertyValue_executionIsolationThreadTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
129128
json.writeNumberField("propertyValue_executionTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
130129
json.writeBooleanField("propertyValue_executionIsolationThreadInterruptOnTimeout", commandProperties.executionIsolationThreadInterruptOnTimeout().get());

hystrix-contrib/hystrix-servo-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/servopublisher/HystrixServoMetricsPublisherCommand.java

-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ public Boolean getValue() {
323323
return properties.circuitBreakerForceClosed().get();
324324
}
325325
});
326-
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
327326
monitors.add(new InformationalMetric<Number>(MonitorConfig.builder("propertyValue_executionIsolationThreadTimeoutInMilliseconds").build()) {
328327
@Override
329328
public Number getValue() {

hystrix-contrib/hystrix-yammer-metrics-publisher/src/main/java/com/netflix/hystrix/contrib/yammermetricspublisher/HystrixYammerMetricsPublisherCommand.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,13 @@ public Boolean value() {
257257
return properties.circuitBreakerForceClosed().get();
258258
}
259259
});
260-
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
261-
metricsRegistry.newGauge(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
260+
metricsRegistry.newGauge(createMetricName("propertyValue_executionTimeoutInMilliseconds"), new Gauge<Number>() {
262261
@Override
263262
public Number value() {
264263
return properties.executionTimeoutInMilliseconds().get();
265264
}
266265
});
267-
metricsRegistry.newGauge(createMetricName("propertyValue_executionTimeoutInMilliseconds"), new Gauge<Number>() {
266+
metricsRegistry.newGauge(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
268267
@Override
269268
public Number value() {
270269
return properties.executionTimeoutInMilliseconds().get();

hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ protected HystrixCommand(HystrixCommandGroupKey group, HystrixThreadPoolKey thre
8484
* <p>
8585
* The {@link HystrixCommandGroupKey} is used to represent a common relationship between commands. For example, a library or team name, the system all related commands interact with,
8686
* common business purpose etc.
87-
* @param executionTimeoutInMilliseconds
88-
* Time in milliseconds at which point the calling thread will timeout and unsubscribe from the command
87+
* @param executionIsolationThreadTimeoutInMilliseconds
88+
* Time in milliseconds at which point the calling thread will timeout (using {@link Future#get}) and walk away from the executing thread.
8989
*/
90-
protected HystrixCommand(HystrixCommandGroupKey group, int executionTimeoutInMilliseconds) {
91-
this(new Setter(group).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionTimeoutInMilliseconds)));
90+
protected HystrixCommand(HystrixCommandGroupKey group, int executionIsolationThreadTimeoutInMilliseconds) {
91+
this(new Setter(group).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionIsolationThreadTimeoutInMilliseconds)));
9292
}
9393

9494
/**
@@ -103,11 +103,11 @@ protected HystrixCommand(HystrixCommandGroupKey group, int executionTimeoutInMil
103103
* common business purpose etc.
104104
* @param threadPool
105105
* {@link HystrixThreadPoolKey} used to identify the thread pool in which a {@link HystrixCommand} executes.
106-
* @param executionTimeoutInMilliseconds
107-
* Time in milliseconds at which point the calling thread will timeout and unsubscribe from the command
106+
* @param executionIsolationThreadTimeoutInMilliseconds
107+
* Time in milliseconds at which point the calling thread will timeout (using {@link Future#get}) and walk away from the executing thread.
108108
*/
109-
protected HystrixCommand(HystrixCommandGroupKey group, HystrixThreadPoolKey threadPool, int executionTimeoutInMilliseconds) {
110-
this(new Setter(group).andThreadPoolKey(threadPool).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionTimeoutInMilliseconds)));
109+
protected HystrixCommand(HystrixCommandGroupKey group, HystrixThreadPoolKey threadPool, int executionIsolationThreadTimeoutInMilliseconds) {
110+
this(new Setter(group).andThreadPoolKey(threadPool).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionIsolationThreadTimeoutInMilliseconds)));
111111
}
112112

113113
/**

hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandProperties.java

+20-15
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public abstract class HystrixCommandProperties {
6868
private final HystrixProperty<Boolean> circuitBreakerForceOpen; // a property to allow forcing the circuit open (stopping all requests)
6969
private final HystrixProperty<Boolean> circuitBreakerForceClosed; // a property to allow ignoring errors and therefore never trip 'open' (ie. allow all traffic through)
7070
private final HystrixProperty<ExecutionIsolationStrategy> executionIsolationStrategy; // Whether a command should be executed in a separate thread or not.
71-
private final HystrixProperty<Integer> executionTimeoutInMilliseconds; // Timeout value in milliseconds for a command.
71+
private final HystrixProperty<Integer> executionTimeoutInMilliseconds; // Timeout value in milliseconds for a command
7272
private final HystrixProperty<String> executionIsolationThreadPoolKeyOverride; // What thread-pool this command should run in (if running on a separate thread).
7373
private final HystrixProperty<Integer> executionIsolationSemaphoreMaxConcurrentRequests; // Number of permits for execution semaphore
7474
private final HystrixProperty<Integer> fallbackIsolationSemaphoreMaxConcurrentRequests; // Number of permits for fallback semaphore
@@ -114,6 +114,8 @@ protected HystrixCommandProperties(HystrixCommandKey key, HystrixCommandProperti
114114
this.circuitBreakerForceOpen = getProperty(propertyPrefix, key, "circuitBreaker.forceOpen", builder.getCircuitBreakerForceOpen(), default_circuitBreakerForceOpen);
115115
this.circuitBreakerForceClosed = getProperty(propertyPrefix, key, "circuitBreaker.forceClosed", builder.getCircuitBreakerForceClosed(), default_circuitBreakerForceClosed);
116116
this.executionIsolationStrategy = getProperty(propertyPrefix, key, "execution.isolation.strategy", builder.getExecutionIsolationStrategy(), default_executionIsolationStrategy);
117+
//this property name is now misleading. //TODO figure out a good way to deprecate this property name
118+
this.executionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.isolation.thread.timeoutInMilliseconds", builder.getExecutionIsolationThreadTimeoutInMilliseconds(), default_executionTimeoutInMilliseconds);
117119
this.executionIsolationThreadInterruptOnTimeout = getProperty(propertyPrefix, key, "execution.isolation.thread.interruptOnTimeout", builder.getExecutionIsolationThreadInterruptOnTimeout(), default_executionIsolationThreadInterruptOnTimeout);
118120
this.executionIsolationSemaphoreMaxConcurrentRequests = getProperty(propertyPrefix, key, "execution.isolation.semaphore.maxConcurrentRequests", builder.getExecutionIsolationSemaphoreMaxConcurrentRequests(), default_executionIsolationSemaphoreMaxConcurrentRequests);
119121
this.fallbackIsolationSemaphoreMaxConcurrentRequests = getProperty(propertyPrefix, key, "fallback.isolation.semaphore.maxConcurrentRequests", builder.getFallbackIsolationSemaphoreMaxConcurrentRequests(), default_fallbackIsolationSemaphoreMaxConcurrentRequests);
@@ -130,10 +132,6 @@ protected HystrixCommandProperties(HystrixCommandKey key, HystrixCommandProperti
130132

131133
// threadpool doesn't have a global override, only instance level makes sense
132134
this.executionIsolationThreadPoolKeyOverride = asProperty(new DynamicStringProperty(propertyPrefix + ".command." + key.name() + ".threadPoolKeyOverride", null));
133-
134-
//thread-specific timeout is deprecated. If the documented property is not used, still respect the deprecated value
135-
HystrixProperty<Integer> deprecatedThreadSpecificExecutionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.isolation.thread.timeoutInMilliseconds", builder.getExecutionTimeoutInMilliseconds(), default_executionTimeoutInMilliseconds);
136-
this.executionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.timeoutInMilliseconds", builder.getExecutionTimeoutInMilliseconds(), deprecatedThreadSpecificExecutionTimeoutInMilliseconds.get());
137135
}
138136

139137
/**
@@ -252,28 +250,32 @@ public HystrixProperty<String> executionIsolationThreadPoolKeyOverride() {
252250
}
253251

254252
/**
255-
* Deprecated in favor of {@link #executionTimeoutInMilliseconds()}
253+
* Time in milliseconds at which point the command will timeout and halt execution.
254+
* <p>
255+
* If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted.
256+
* If the command is semaphore-isolated and a {@link HystrixObservableCommand}, that command will get unsubscribed.
257+
* <p>
258+
*
256259
* @return {@code HystrixProperty<Integer>}
257260
*/
258-
@Deprecated
261+
@Deprecated //prefer {@link #executionTimeoutInMilliseconds}
259262
public HystrixProperty<Integer> executionIsolationThreadTimeoutInMilliseconds() {
260263
return executionTimeoutInMilliseconds;
261264
}
262265

263266
/**
264-
* Time in milliseconds at which point the calling thread will timeout
267+
* Time in milliseconds at which point the command will timeout and halt execution.
265268
* <p>
266-
* If the command is thread-isolated and {@link #executionIsolationThreadInterruptOnTimeout} == true, the executing thread will be interrupted.
269+
* If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted.
270+
* If the command is semaphore-isolated and a {@link HystrixObservableCommand}, that command will get unsubscribed.
267271
* <p>
268-
* In both semaphore- and thread-isolated commands, the command will be unsubscribed from. If the command is a {@link HystrixObservableCommand},
269-
* it should respect this unsubscription and stop as early as it is able
270272
*
271273
* @return {@code HystrixProperty<Integer>}
272274
*/
273275
public HystrixProperty<Integer> executionTimeoutInMilliseconds() {
274276
return executionTimeoutInMilliseconds;
275277
}
276-
278+
277279
/**
278280
* Number of concurrent requests permitted to {@link HystrixCommand#getFallback()}. Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback.
279281
*
@@ -546,7 +548,7 @@ public Boolean getExecutionIsolationThreadInterruptOnTimeout() {
546548
return executionIsolationThreadInterruptOnTimeout;
547549
}
548550

549-
@Deprecated
551+
@Deprecated //prefer getExecutionTimeoutInMillisconds()
550552
public Integer getExecutionIsolationThreadTimeoutInMilliseconds() {
551553
return executionTimeoutInMilliseconds;
552554
}
@@ -644,7 +646,7 @@ public Setter withExecutionIsolationThreadInterruptOnTimeout(boolean value) {
644646
return this;
645647
}
646648

647-
@Deprecated
649+
@Deprecated //prefer {@link #withExecutionTimeoutInMilliseconds}
648650
public Setter withExecutionIsolationThreadTimeoutInMilliseconds(int value) {
649651
this.executionTimeoutInMilliseconds = value;
650652
return this;
@@ -654,7 +656,7 @@ public Setter withExecutionTimeoutInMilliseconds(int value) {
654656
this.executionTimeoutInMilliseconds = value;
655657
return this;
656658
}
657-
659+
658660
public Setter withFallbackIsolationSemaphoreMaxConcurrentRequests(int value) {
659661
this.fallbackIsolationSemaphoreMaxConcurrentRequests = value;
660662
return this;
@@ -709,5 +711,8 @@ public Setter withRequestLogEnabled(boolean value) {
709711
this.requestLogEnabled = value;
710712
return this;
711713
}
714+
712715
}
716+
717+
713718
}

hystrix-core/src/test/java/com/netflix/hystrix/HystrixCollapserTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ private static class TestCollapserCommand extends TestHystrixCommand<List<String
10971097
private final Collection<CollapsedRequest<String, String>> requests;
10981098

10991099
TestCollapserCommand(Collection<CollapsedRequest<String, String>> requests) {
1100-
super(testPropsBuilder().setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionIsolationThreadTimeoutInMilliseconds(50)));
1100+
super(testPropsBuilder().setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionTimeoutInMilliseconds(50)));
11011101
this.requests = requests;
11021102
}
11031103

hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandPropertiesTest.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class HystrixCommandPropertiesTest {
3232
*/
3333
/* package */static HystrixCommandProperties.Setter getUnitTestPropertiesSetter() {
3434
return new HystrixCommandProperties.Setter()
35-
.withExecutionIsolationThreadTimeoutInMilliseconds(1000)// when an execution will be timed out
35+
.withExecutionTimeoutInMilliseconds(1000)// when an execution will be timed out
3636
.withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) // we want thread execution by default in tests
3737
.withExecutionIsolationThreadInterruptOnTimeout(true)
3838
.withCircuitBreakerForceOpen(false) // we don't want short-circuiting by default
@@ -115,11 +115,6 @@ public HystrixProperty<String> executionIsolationThreadPoolKeyOverride() {
115115
return HystrixProperty.Factory.nullProperty();
116116
}
117117

118-
@Override
119-
public HystrixProperty<Integer> executionIsolationThreadTimeoutInMilliseconds() {
120-
return HystrixProperty.Factory.asProperty(builder.getExecutionTimeoutInMilliseconds());
121-
}
122-
123118
@Override
124119
public HystrixProperty<Integer> executionTimeoutInMilliseconds() {
125120
return HystrixProperty.Factory.asProperty(builder.getExecutionTimeoutInMilliseconds());

0 commit comments

Comments
 (0)