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

 ##########
 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:
   当有多个 HystrixConcurrencyStrategy 接口实现的时候,如果每个实现方式都是在 HystrixPlugins.reset(); 
后重新注册,会不会导致创建多次 ServiceCombConcurrencyStrategy。这一点我不太确定,只是怀疑。
   
   我觉得可以先判断 HystrixPlugins.getInstance().getConcurrencyStrategy 是否已经是 
ServiceCombConcurrencyStrategy 实例,如果已经是这个实例可以直接 return

----------------------------------------------------------------
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