一、修改参数
设置参数有3个地方:通过日志
2018-02-12 18:07:36.876 DEBUG HystrixPropertiesChainedProperty:93 - Flipping property: hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds to use NEXT property: hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds = 1000
2018-02-12 18:07:37.113 DEBUG HystrixPropertiesChainedProperty:236 - Property changed: ‘hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds = 500‘
可以看到3个参数
hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
hystrix.command.HttpPostCommand.execution.isolation.thread.timeoutInMilliseconds
》》其中default是在 command类之外
ConfigurationManager.getConfigInstance().setProperty("hystrix.command.default.circuitBreaker.forceOpen", true);
》》然后剩下的那个可以在command类内修改
二、在 callback中打印异常信息
@Override
protected String getFallback() {
// String reason=null;
// if (isCircuitBreakerOpen()) {
// reason = "Circuit Breaker Open";
// } else if (isResponseRejected()) {
// reason = "Response rejected";
// } else if (isResponseTimedOut()) {
// reason = "Response timed-out";
// }
//System.out.println("进入回调");
log.info("发生了回调异常信息是"+ getExecutionException());
return null;
}
参考
http://www.cnblogs.com/ulysses-you/p/7281662.html
原文地址:https://www.cnblogs.com/amazement/p/8445294.html