Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert timeout property name change #675

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ public Boolean getValue() {
return properties.circuitBreakerForceClosed().get();
}
});
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
metricRegistry.register(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
@Override
public Number getValue() {
Expand Down
6 changes: 3 additions & 3 deletions hystrix-contrib/hystrix-javanica/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ Command properties can be set using @HystrixCommand's 'commandProperties' like b

```java
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "500")
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500")
})
public User getUserById(String id) {
return userResource.getUserById(id);
Expand All @@ -353,15 +353,15 @@ Command properties can be set using @HystrixCommand's 'commandProperties' like b
Javanica dynamically sets properties using Hystrix ConfigurationManager.
For the example above Javanica behind the scenes performs next action:
```java
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.getUserById.execution.timeoutInMilliseconds", "500");
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.getUserById.execution.isolation.thread.timeoutInMilliseconds", "500");
```
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)

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

```java
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "500")
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "500")
},
threadPoolProperties = {
@HystrixProperty(name = "coreSize", value = "30"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static class UserService {

@HystrixCommand(commandKey = "GetUserCommand", groupKey = "UserGroupKey", threadPoolKey = "Test",
commandProperties = {
@HystrixProperty(name = "execution.timeoutInMilliseconds", value = "110"),
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "110"),
@HystrixProperty(name = "execution.isolation.thread.interruptOnTimeout", value = "false")
},
threadPoolProperties = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ private String getCommandJson(HystrixCommandMetrics commandMetrics) throws IOExc
json.writeBooleanField("propertyValue_circuitBreakerEnabled", commandProperties.circuitBreakerEnabled().get());

json.writeStringField("propertyValue_executionIsolationStrategy", commandProperties.executionIsolationStrategy().get().name());
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
json.writeNumberField("propertyValue_executionIsolationThreadTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
json.writeNumberField("propertyValue_executionTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
json.writeBooleanField("propertyValue_executionIsolationThreadInterruptOnTimeout", commandProperties.executionIsolationThreadInterruptOnTimeout().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ static String toJson(HystrixCommandMetrics commandMetrics) throws IOException {
json.writeBooleanField("propertyValue_circuitBreakerEnabled", commandProperties.circuitBreakerEnabled().get());

json.writeStringField("propertyValue_executionIsolationStrategy", commandProperties.executionIsolationStrategy().get().name());
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
json.writeNumberField("propertyValue_executionIsolationThreadTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
json.writeNumberField("propertyValue_executionTimeoutInMilliseconds", commandProperties.executionTimeoutInMilliseconds().get());
json.writeBooleanField("propertyValue_executionIsolationThreadInterruptOnTimeout", commandProperties.executionIsolationThreadInterruptOnTimeout().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ public Boolean getValue() {
return properties.circuitBreakerForceClosed().get();
}
});
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
monitors.add(new InformationalMetric<Number>(MonitorConfig.builder("propertyValue_executionIsolationThreadTimeoutInMilliseconds").build()) {
@Override
public Number getValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,13 @@ public Boolean value() {
return properties.circuitBreakerForceClosed().get();
}
});
//this naming convention is deprecated as of 1.4.0-RC7, remove in 1.5.x
metricsRegistry.newGauge(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
metricsRegistry.newGauge(createMetricName("propertyValue_executionTimeoutInMilliseconds"), new Gauge<Number>() {
@Override
public Number value() {
return properties.executionTimeoutInMilliseconds().get();
}
});
metricsRegistry.newGauge(createMetricName("propertyValue_executionTimeoutInMilliseconds"), new Gauge<Number>() {
metricsRegistry.newGauge(createMetricName("propertyValue_executionIsolationThreadTimeoutInMilliseconds"), new Gauge<Number>() {
@Override
public Number value() {
return properties.executionTimeoutInMilliseconds().get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ protected HystrixCommand(HystrixCommandGroupKey group, HystrixThreadPoolKey thre
* <p>
* 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,
* common business purpose etc.
* @param executionTimeoutInMilliseconds
* Time in milliseconds at which point the calling thread will timeout and unsubscribe from the command
* @param executionIsolationThreadTimeoutInMilliseconds
* Time in milliseconds at which point the calling thread will timeout (using {@link Future#get}) and walk away from the executing thread.
*/
protected HystrixCommand(HystrixCommandGroupKey group, int executionTimeoutInMilliseconds) {
this(new Setter(group).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionTimeoutInMilliseconds)));
protected HystrixCommand(HystrixCommandGroupKey group, int executionIsolationThreadTimeoutInMilliseconds) {
this(new Setter(group).andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(executionIsolationThreadTimeoutInMilliseconds)));
}

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

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

// threadpool doesn't have a global override, only instance level makes sense
this.executionIsolationThreadPoolKeyOverride = asProperty(new DynamicStringProperty(propertyPrefix + ".command." + key.name() + ".threadPoolKeyOverride", null));

//thread-specific timeout is deprecated. If the documented property is not used, still respect the deprecated value
HystrixProperty<Integer> deprecatedThreadSpecificExecutionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.isolation.thread.timeoutInMilliseconds", builder.getExecutionTimeoutInMilliseconds(), default_executionTimeoutInMilliseconds);
this.executionTimeoutInMilliseconds = getProperty(propertyPrefix, key, "execution.timeoutInMilliseconds", builder.getExecutionTimeoutInMilliseconds(), deprecatedThreadSpecificExecutionTimeoutInMilliseconds.get());
}

/**
Expand Down Expand Up @@ -252,28 +250,32 @@ public HystrixProperty<String> executionIsolationThreadPoolKeyOverride() {
}

/**
* Deprecated in favor of {@link #executionTimeoutInMilliseconds()}
* Time in milliseconds at which point the command will timeout and halt execution.
* <p>
* If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted.
* If the command is semaphore-isolated and a {@link HystrixObservableCommand}, that command will get unsubscribed.
* <p>
*
* @return {@code HystrixProperty<Integer>}
*/
@Deprecated
@Deprecated //prefer {@link #executionTimeoutInMilliseconds}
public HystrixProperty<Integer> executionIsolationThreadTimeoutInMilliseconds() {
return executionTimeoutInMilliseconds;
}

/**
* Time in milliseconds at which point the calling thread will timeout
* Time in milliseconds at which point the command will timeout and halt execution.
* <p>
* If the command is thread-isolated and {@link #executionIsolationThreadInterruptOnTimeout} == true, the executing thread will be interrupted.
* If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted.
* If the command is semaphore-isolated and a {@link HystrixObservableCommand}, that command will get unsubscribed.
* <p>
* In both semaphore- and thread-isolated commands, the command will be unsubscribed from. If the command is a {@link HystrixObservableCommand},
* it should respect this unsubscription and stop as early as it is able
*
* @return {@code HystrixProperty<Integer>}
*/
public HystrixProperty<Integer> executionTimeoutInMilliseconds() {
return executionTimeoutInMilliseconds;
}

/**
* Number of concurrent requests permitted to {@link HystrixCommand#getFallback()}. Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback.
*
Expand Down Expand Up @@ -546,7 +548,7 @@ public Boolean getExecutionIsolationThreadInterruptOnTimeout() {
return executionIsolationThreadInterruptOnTimeout;
}

@Deprecated
@Deprecated //prefer getExecutionTimeoutInMillisconds()
public Integer getExecutionIsolationThreadTimeoutInMilliseconds() {
return executionTimeoutInMilliseconds;
}
Expand Down Expand Up @@ -644,7 +646,7 @@ public Setter withExecutionIsolationThreadInterruptOnTimeout(boolean value) {
return this;
}

@Deprecated
@Deprecated //prefer {@link #withExecutionTimeoutInMilliseconds}
public Setter withExecutionIsolationThreadTimeoutInMilliseconds(int value) {
this.executionTimeoutInMilliseconds = value;
return this;
Expand All @@ -654,7 +656,7 @@ public Setter withExecutionTimeoutInMilliseconds(int value) {
this.executionTimeoutInMilliseconds = value;
return this;
}

public Setter withFallbackIsolationSemaphoreMaxConcurrentRequests(int value) {
this.fallbackIsolationSemaphoreMaxConcurrentRequests = value;
return this;
Expand Down Expand Up @@ -709,5 +711,8 @@ public Setter withRequestLogEnabled(boolean value) {
this.requestLogEnabled = value;
return this;
}

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ private static class TestCollapserCommand extends TestHystrixCommand<List<String
private final Collection<CollapsedRequest<String, String>> requests;

TestCollapserCommand(Collection<CollapsedRequest<String, String>> requests) {
super(testPropsBuilder().setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionIsolationThreadTimeoutInMilliseconds(50)));
super(testPropsBuilder().setCommandPropertiesDefaults(HystrixCommandPropertiesTest.getUnitTestPropertiesSetter().withExecutionTimeoutInMilliseconds(50)));
this.requests = requests;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class HystrixCommandPropertiesTest {
*/
/* package */static HystrixCommandProperties.Setter getUnitTestPropertiesSetter() {
return new HystrixCommandProperties.Setter()
.withExecutionIsolationThreadTimeoutInMilliseconds(1000)// when an execution will be timed out
.withExecutionTimeoutInMilliseconds(1000)// when an execution will be timed out
.withExecutionIsolationStrategy(ExecutionIsolationStrategy.THREAD) // we want thread execution by default in tests
.withExecutionIsolationThreadInterruptOnTimeout(true)
.withCircuitBreakerForceOpen(false) // we don't want short-circuiting by default
Expand Down Expand Up @@ -115,11 +115,6 @@ public HystrixProperty<String> executionIsolationThreadPoolKeyOverride() {
return HystrixProperty.Factory.nullProperty();
}

@Override
public HystrixProperty<Integer> executionIsolationThreadTimeoutInMilliseconds() {
return HystrixProperty.Factory.asProperty(builder.getExecutionTimeoutInMilliseconds());
}

@Override
public HystrixProperty<Integer> executionTimeoutInMilliseconds() {
return HystrixProperty.Factory.asProperty(builder.getExecutionTimeoutInMilliseconds());
Expand Down