我有一个断路器设置,我想要更改运行时的参数。像线程和超时这样的东西需要在客户现场进行调整。
我创建一个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));
MyCommand实现标准HystrixCommand并调用super(hystrixProps)。
这在第一次是有效的,但是当我尝试在运行时更改属性(相同的组名)时,没有任何反应。有没有其他方法可以通过编程来改变这一点?
我不想遍历属性文件或指定Archaius的URL。
也有一些答案告诉我要通过ConfigurationManager.getConfigInstance().setProperty("...")了解阿查尤斯。但肯定会有一种类似于我创建的原始setter的方式?做这件事完全不同,因为这是第二次,感觉很尴尬。
https://stackoverflow.com/questions/40109374
复制相似问题