dromara / hmily

Distributed transaction solutions
https://dromara.org
Apache License 2.0
4.11k stars 1.41k forks source link

springcloud 开启hystrix 重写HmilyHystrixConcurrencyStrategy #322

Open qianxuwanyu opened 3 years ago

qianxuwanyu commented 3 years ago

HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); 应在 HystrixPlugins.reset(); 重置前 获取当前变量,否则 显示已注册

FrameWorkHome commented 2 years ago

有修改说明吗 我也遇到了这个问题,想知道怎么解决呢

qianxuwanyu commented 2 years ago

有修改说明吗 我也遇到了这个问题,想知道怎么解决呢

有的,应该是单例模式问题

HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance().getCommandExecutionHook(); HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance() .getEventNotifier(); HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance() .getMetricsPublisher(); HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance() .getPropertiesStrategy(); LOGGER.debug("HystrixEventNotifier:{}, HystrixMetricsPublisher:{}, HystrixPropertiesStrategy:{}", eventNotifier, metricsPublisher, propertiesStrategy); HystrixPlugins.reset(); HystrixPlugins.getInstance().registerConcurrencyStrategy(this); HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook); HystrixPlugins.getInstance().registerEventNotifier(eventNotifier); HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher); HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy);

qianxuwanyu commented 2 years ago

自己比对下,把对象返回出来 再塞进去