You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/10/17 03:19:39 UTC

[GitHub] [servicecomb-pack] xiangyuQi commented on a change in pull request #572: fix issue #571

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

 ##########
 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 : qixiangyu18@163.com
+ */
+@Configuration
+@Order
+@ConditionalOnClass({Hystrix.class})
+public class HystrixServiceCombAutoConfiguration {
+
+	@Autowired
+	Optional<List<HystrixCallableWrapper>> hystrixCallableWrappers;
+
+	@PostConstruct
+	public void init() {
 
 Review comment:
   嗯,有必要加这个判断,如果有实现类直接继承了ServiceCombConcurrencyStrategy,并且在之前注册了,那应该会有问题.谢谢你的建议 :)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services