码迷,mamicode.com
首页 > 其他好文 > 详细

hystrix熔断机制修改配置

时间:2018-02-12 20:10:56      阅读:685      评论:0      收藏:0      [点我收藏+]

标签:nbsp   src   int   default   ted   get   info   cep   over   

一、修改参数

设置参数有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

hystrix熔断机制修改配置

标签:nbsp   src   int   default   ted   get   info   cep   over   

原文地址:https://www.cnblogs.com/amazement/p/8445294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!