in omega/omega-transport/omega-transport-hystrix/src/main/java/org/apache/servicecomb/pack/omega/transport/hystrix/HystrixServiceCombAutoConfiguration.java [57:101]
public void init() {
try {
if (CollectionUtils.isEmpty(hystrixCallableWrappers)) {
log.info(
"no hystrixCallableWrapper find ,ServiceCombConcurrencyStrategy ignore Configuration");
return;
}
HystrixConcurrencyStrategy concurrencyStrategy = detectRegisteredConcurrencyStrategy();
if (concurrencyStrategy instanceof ServiceCombConcurrencyStrategy) {
log.info(
"Current Hystrix plugins concurrencyStrategy is ServiceCombConcurrencyStrategy ignore Configuration");
return;
}
// Keeps references of existing Hystrix plugins.
HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance()
.getEventNotifier();
HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance()
.getMetricsPublisher();
HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance()
.getPropertiesStrategy();
HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance()
.getCommandExecutionHook();
log.info("Current Hystrix plugins configuration is ["
+ "concurrencyStrategy [" + concurrencyStrategy + "]," + "eventNotifier ["
+ eventNotifier + "]," + "metricPublisher [" + metricsPublisher + "],"
+ "propertiesStrategy [" + propertiesStrategy + "]," + "]");
HystrixPlugins.reset();
// Registers existing plugins excepts the Concurrent Strategy plugin.
HystrixPlugins.getInstance().registerConcurrencyStrategy(
new ServiceCombConcurrencyStrategy(concurrencyStrategy, hystrixCallableWrappers));
HystrixPlugins.getInstance().registerEventNotifier(eventNotifier);
HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher);
HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy);
HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook);
log.info("Succeeded to register ServiceComb Hystrix Concurrency Strategy");
} catch (Exception e) {
log.error("Failed to register ServiceComb Hystrix Concurrency Strategy", e);
}
}