From 31ea78c7bdd0ad11acab36b45f87a559d8e29dbd Mon Sep 17 00:00:00 2001 From: lukuan Date: Sun, 17 Jul 2022 18:51:15 +0800 Subject: [PATCH 1/2] The scheduled task configuration of the adaptation module is optimized --- ...dPoolAdapterScheduleAutoConfiguration.java | 33 ------------------- .../main/resources/META-INF/spring.factories | 1 - .../hystrix}/ThreadPoolAdapterScheduler.java | 2 +- .../HystrixAdapterAutoConfiguration.java | 9 +++-- .../DynamicThreadPoolAutoConfiguration.java | 1 - 5 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduleAutoConfiguration.java delete mode 100644 hippo4j-adapter/hippo4j-adapter-base/src/main/resources/META-INF/spring.factories rename hippo4j-adapter/{hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base => hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix}/ThreadPoolAdapterScheduler.java (97%) diff --git a/hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduleAutoConfiguration.java b/hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduleAutoConfiguration.java deleted file mode 100644 index 9ae57d8b..00000000 --- a/hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduleAutoConfiguration.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * - * http://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 cn.hippo4j.adapter.base; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * thread pool adapter extra auto configuration. - */ -@Configuration(proxyBeanMethods = false) -public class ThreadPoolAdapterScheduleAutoConfiguration { - - @Bean - public ThreadPoolAdapterScheduler threadPoolAdapterExtra() { - return new ThreadPoolAdapterScheduler(); - } -} diff --git a/hippo4j-adapter/hippo4j-adapter-base/src/main/resources/META-INF/spring.factories b/hippo4j-adapter/hippo4j-adapter-base/src/main/resources/META-INF/spring.factories deleted file mode 100644 index a3fc44d3..00000000 --- a/hippo4j-adapter/hippo4j-adapter-base/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=cn.hippo4j.adapter.base.ThreadPoolAdapterScheduleAutoConfiguration diff --git a/hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduler.java b/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/ThreadPoolAdapterScheduler.java similarity index 97% rename from hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduler.java rename to hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/ThreadPoolAdapterScheduler.java index 6411a2d4..c3063b7e 100644 --- a/hippo4j-adapter/hippo4j-adapter-base/src/main/java/cn/hippo4j/adapter/base/ThreadPoolAdapterScheduler.java +++ b/hippo4j-adapter/hippo4j-adapter-hystrix/src/main/java/cn/hippo4j/adapter/hystrix/ThreadPoolAdapterScheduler.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.adapter.base; +package cn.hippo4j.adapter.hystrix; import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.extern.slf4j.Slf4j; diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java index 26800ee6..e52fe547 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java @@ -17,9 +17,8 @@ package cn.hippo4j.springboot.starter.adapter.hystrix; -import cn.hippo4j.adapter.base.ThreadPoolAdapterScheduler; -import cn.hippo4j.adapter.base.ThreadPoolAdapterScheduleAutoConfiguration; import cn.hippo4j.adapter.hystrix.HystrixThreadPoolAdapter; +import cn.hippo4j.adapter.hystrix.ThreadPoolAdapterScheduler; import cn.hippo4j.common.config.ApplicationContextHolder; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -33,7 +32,6 @@ import org.springframework.context.annotation.Configuration; * @create: 2022-07-15 **/ @Configuration(proxyBeanMethods = false) -@AutoConfigureAfter(ThreadPoolAdapterScheduleAutoConfiguration.class) public class HystrixAdapterAutoConfiguration { @Bean @@ -42,6 +40,11 @@ public class HystrixAdapterAutoConfiguration { return new ApplicationContextHolder(); } + @Bean + public ThreadPoolAdapterScheduler threadPoolAdapterExtra() { + return new ThreadPoolAdapterScheduler(); + } + @Bean public HystrixThreadPoolAdapter hystrixThreadPoolAdapter(ThreadPoolAdapterScheduler threadPoolAdapterScheduler) { return new HystrixThreadPoolAdapter(threadPoolAdapterScheduler); diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java index bee2aa09..4c305e01 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -18,7 +18,6 @@ package cn.hippo4j.springboot.starter.config; import cn.hippo4j.adapter.base.ThreadPoolAdapterBeanContainer; -import cn.hippo4j.adapter.base.ThreadPoolAdapterScheduler; import cn.hippo4j.common.api.ThreadDetailState; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.core.config.UtilAutoConfiguration; From bdbed0308adcfd0cec9157d393f0118f6d6bf7f4 Mon Sep 17 00:00:00 2001 From: lukuan Date: Sun, 17 Jul 2022 19:02:33 +0800 Subject: [PATCH 2/2] The scheduled task configuration of the adaptation module is optimized --- .../adapter/hystrix/HystrixAdapterAutoConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java index e52fe547..d7e3e5a8 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-adapter/hippo4j-spring-boot-starter-adapter-hystrix/src/main/java/cn/hippo4j/springboot/starter/adapter/hystrix/HystrixAdapterAutoConfiguration.java @@ -41,7 +41,7 @@ public class HystrixAdapterAutoConfiguration { } @Bean - public ThreadPoolAdapterScheduler threadPoolAdapterExtra() { + public ThreadPoolAdapterScheduler threadPoolAdapterScheduler() { return new ThreadPoolAdapterScheduler(); }