一、结论
hystrix:
command:default: #default全局有效
execution:
timeout:
#是否开启超时熔断
enabled:true
isolation:
thread:
timeoutInMilliseconds:6000 #断路器超时时间,默认1000ms
HystrixCommonKey: #HystrixCommandKey:要单独设置超时时间的方法
execution:
timeout:
#是否开启超时熔断,默认true
enabled:true
isolation:
thread:
timeoutInMilliseconds:10000 #断路器超时时间
二、查看HystrixCommandKey
HystrixCommonKey:类名#方法名(参数类型)
publicstatic StringconfigKey(ClasstargetType, Method method){
StringBuilder builder=newStringBuilder();
builder.append(targetType.getSimpleName());
builder.append('#').append(method.getName()).append('(');for(Type param: method.getGenericParameterTypes()){
param= Types.resolve(targetType, targetType, param);
builder.append(Types.getRawType(param).getSimpleName()).append(',');}if(method.getParameterTypes().length>0){
builder.deleteCharAt(builder.length()-1);}return builder.append(')').toString();}