小编And*_*s S的帖子

以编程方式更改Hystrix属性

我有一个断路器设置,我想改变运行时的参数.需要在客户站点调整线程和超时等内容.

我像这样创建一个HystrixCommandProperties.Setter:

HystrixCommandProperties.Setter hystrixProps = 
    HystrixCommandProperties.defaultSetter()
        .withCircuitBreakerSleepWindowInMilliseconds(myconf.sleepWindow);
HystrixThreadPoolProperties.Setter threadPoolSettings = 
    HystrixThreadPoolProperties.Setter()
        .withCoreSize(myconf.threadPoolSize);

new MyCommand(HystrixCommand.Setter.withGroupKey("mygroup")
    .andCommandPropertiesDefaults(hystrixProps)
    .andThreadPoolPropertiesDefaults(threadPoolSettings));
Run Code Online (Sandbox Code Playgroud)

MyCommand实现标准的HystrixCommand并调用super(hystrixProps).

这是第一次工作,但是当我尝试在运行时更改属性(相同的组名)时没有任何反应.还有另一种以编程方式更改此方法的方法吗?

我不想浏览属性文件或指定Archaius的URL.

还有答案告诉我使用ConfigurationManager.getConfigInstance().setProperty("...")来浏览Archaius.但肯定有一种类似于我创造的原始设定者的方式吗?这样做完全不同,因为这是第二次感觉很尴尬.

java circuit-breaker hystrix

8
推荐指数
2
解决办法
6007
查看次数

标签 统计

circuit-breaker ×1

hystrix ×1

java ×1