coolbeevip commented on a change in pull request #572: fix issue #571
URL: https://github.com/apache/servicecomb-pack/pull/572#discussion_r335799406
 
 

 ##########
 File path: 
omega/omega-transport/omega-transport-feign/src/main/java/org/apache/servicecomb/pack/omega/transport/feign/hystrix/HystrixServiceCombAutoConfiguration.java
 ##########
 @@ -0,0 +1,85 @@
+/*
+ * Copyright 2013-2019 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.pack.omega.transport.feign.hystrix;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+import java.util.Optional;
+
+import com.netflix.hystrix.Hystrix;
+import com.netflix.hystrix.strategy.HystrixPlugins;
+import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
+import com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier;
+import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
+import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
+import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
+import org.apache.servicecomb.pack.omega.context.OmegaContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
+
+/**
+ * 使用hystrix情况下,自动注册ServiceCombConcurrencyStrategy
+ * @author : qixiangy...@163.com
+ */
+@Configuration
+@Order
+@ConditionalOnClass({Hystrix.class})
+public class HystrixServiceCombAutoConfiguration {
+
+       @Autowired
+       Optional<List<HystrixCallableWrapper>> hystrixCallableWrappers;
+
+       @PostConstruct
+       public void init() {
 
 Review comment:
   
目前看来我也没有太好的建议,因为我们无法控制还有哪些组件扩展了这个接口,不过我建议在日志中打印这个组件注册成功或者注册失败的日志,这样再出现类似问题的时候我们可以通过日志看到我们的这个组件是否成功注册,如果已经成功注册,但是还有问题,我们就可以怀疑这个项目还用了其他类似的组件,可以缩小问题排查范围
   
   关于 @order 我觉得如果我们已知一些组件的加载顺序需要控制,那么可以采用此方式。另外我印象中  @AutoconfigureOrder 
是专门为已知自动配置类提供排序,用这个可能性能会好一点吧。

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to