diff --git a/hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/ConfigApolloExampleApplication.java b/hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloExampleApplication.java similarity index 96% rename from hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/ConfigApolloExampleApplication.java rename to hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloExampleApplication.java index 0a7834b1..fb585712 100644 --- a/hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/apollo/ConfigApolloExampleApplication.java +++ b/hippo4j-example/hippo4j-config-apollo-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/apollo/ConfigApolloExampleApplication.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.example.core.apollo; +package cn.hippo4j.example.config.apollo; import cn.hippo4j.core.enable.EnableDynamicThreadPool; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @EnableDynamicThreadPool -@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.core") +@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.config") public class ConfigApolloExampleApplication { public static void main(String[] args) { diff --git a/hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/nacos/ConfigNacosExampleApplication.java b/hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/nacos/ConfigNacosExampleApplication.java similarity index 96% rename from hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/nacos/ConfigNacosExampleApplication.java rename to hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/nacos/ConfigNacosExampleApplication.java index fa074e1b..76847c66 100644 --- a/hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/nacos/ConfigNacosExampleApplication.java +++ b/hippo4j-example/hippo4j-config-nacos-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/nacos/ConfigNacosExampleApplication.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.example.core.nacos; +package cn.hippo4j.example.config.nacos; import cn.hippo4j.core.enable.EnableDynamicThreadPool; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @EnableDynamicThreadPool -@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.core") +@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.config") public class ConfigNacosExampleApplication { public static void main(String[] args) { diff --git a/hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/zookeeper/ConfigZookeeperExampleApplication.java b/hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/zookeeper/ConfigZookeeperExampleApplication.java similarity index 96% rename from hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/zookeeper/ConfigZookeeperExampleApplication.java rename to hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/zookeeper/ConfigZookeeperExampleApplication.java index 2d545792..f047a8f3 100644 --- a/hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/core/zookeeper/ConfigZookeeperExampleApplication.java +++ b/hippo4j-example/hippo4j-config-zookeeper-spring-boot-starter-example/src/main/java/cn/hippo4j/example/config/zookeeper/ConfigZookeeperExampleApplication.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.example.core.zookeeper; +package cn.hippo4j.example.config.zookeeper; import cn.hippo4j.core.enable.EnableDynamicThreadPool; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @EnableDynamicThreadPool -@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.core") +@SpringBootApplication(scanBasePackages = "cn.hippo4j.example.config") public class ConfigZookeeperExampleApplication { public static void main(String[] args) { diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/common/ConfigFileTypeEnum.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/common/ConfigFileTypeEnum.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/common/ConfigFileTypeEnum.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/common/ConfigFileTypeEnum.java index 4fc820a1..6a676163 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/common/ConfigFileTypeEnum.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/common/ConfigFileTypeEnum.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.common; +package cn.hippo4j.config.springboot.starter.common; /** * Config file type enum. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/AdapterExecutorProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/AdapterExecutorProperties.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/AdapterExecutorProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/AdapterExecutorProperties.java index 9328b6de..f78a2539 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/AdapterExecutorProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/AdapterExecutorProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import lombok.Data; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/BootstrapConfigProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/BootstrapConfigProperties.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/BootstrapConfigProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/BootstrapConfigProperties.java index 62ec0ffe..8a534f69 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/BootstrapConfigProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/BootstrapConfigProperties.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import java.util.List; import java.util.Map; import cn.hippo4j.core.config.BootstrapPropertiesInterface; -import cn.hippo4j.core.springboot.starter.parser.ConfigFileTypeEnum; +import cn.hippo4j.config.springboot.starter.parser.ConfigFileTypeEnum; import lombok.Getter; import lombok.Setter; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ConfigHandlerConfiguration.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java similarity index 89% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ConfigHandlerConfiguration.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java index 493d2f1d..0685a0a3 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ConfigHandlerConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; -import cn.hippo4j.core.springboot.starter.refresher.ApolloRefresherHandler; -import cn.hippo4j.core.springboot.starter.refresher.NacosCloudRefresherHandler; -import cn.hippo4j.core.springboot.starter.refresher.NacosRefresherHandler; -import cn.hippo4j.core.springboot.starter.refresher.ZookeeperRefresherHandler; -import cn.hippo4j.core.springboot.starter.refresher.EtcdRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.ApolloRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.NacosCloudRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.NacosRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.ZookeeperRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.EtcdRefresherHandler; import com.alibaba.cloud.nacos.NacosConfigManager; import com.alibaba.nacos.api.config.ConfigService; import io.etcd.jetcd.Client; @@ -102,6 +102,5 @@ public class ConfigHandlerConfiguration { return new EtcdRefresherHandler(); } } - - + } diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java similarity index 86% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java index a221798f..fd8ce8f5 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolCoreAutoConfiguration.java @@ -15,22 +15,22 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.core.config.UtilAutoConfiguration; import cn.hippo4j.core.enable.MarkerConfiguration; import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler; import cn.hippo4j.core.handler.DynamicThreadPoolBannerHandler; -import cn.hippo4j.core.springboot.starter.monitor.DynamicThreadPoolMonitorExecutor; -import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder; -import cn.hippo4j.core.springboot.starter.refresher.event.AdapterExecutorsRefreshListener; -import cn.hippo4j.core.springboot.starter.refresher.event.DynamicThreadPoolRefreshListener; -import cn.hippo4j.core.springboot.starter.refresher.event.PlatformsRefreshListener; -import cn.hippo4j.core.springboot.starter.refresher.event.WebExecutorRefreshListener; -import cn.hippo4j.core.springboot.starter.support.DynamicThreadPoolAdapterRegister; -import cn.hippo4j.core.springboot.starter.support.DynamicThreadPoolConfigService; -import cn.hippo4j.core.springboot.starter.support.DynamicThreadPoolPostProcessor; +import cn.hippo4j.config.springboot.starter.monitor.DynamicThreadPoolMonitorExecutor; +import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder; +import cn.hippo4j.config.springboot.starter.refresher.event.AdapterExecutorsRefreshListener; +import cn.hippo4j.config.springboot.starter.refresher.event.DynamicThreadPoolRefreshListener; +import cn.hippo4j.config.springboot.starter.refresher.event.PlatformsRefreshListener; +import cn.hippo4j.config.springboot.starter.refresher.event.WebExecutorRefreshListener; +import cn.hippo4j.config.springboot.starter.support.DynamicThreadPoolAdapterRegister; +import cn.hippo4j.config.springboot.starter.support.DynamicThreadPoolConfigService; +import cn.hippo4j.config.springboot.starter.support.DynamicThreadPoolPostProcessor; import cn.hippo4j.message.api.NotifyConfigBuilder; import cn.hippo4j.message.config.MessageConfiguration; import cn.hippo4j.message.service.AlarmControlHandler; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolNotifyProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolNotifyProperties.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolNotifyProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolNotifyProperties.java index 5ca1836b..8f94c1a5 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/DynamicThreadPoolNotifyProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/DynamicThreadPoolNotifyProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ExecutorProperties.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ExecutorProperties.java index 735a0d13..71cc5f69 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/ExecutorProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ExecutorProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/NotifyPlatformProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/NotifyPlatformProperties.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/NotifyPlatformProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/NotifyPlatformProperties.java index 6b645de0..95a5c0ed 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/NotifyPlatformProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/NotifyPlatformProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import lombok.Data; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/WebThreadPoolProperties.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/WebThreadPoolProperties.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/WebThreadPoolProperties.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/WebThreadPoolProperties.java index 915a0c4d..437f8d8e 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/config/WebThreadPoolProperties.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/WebThreadPoolProperties.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.config; +package cn.hippo4j.config.springboot.starter.config; import lombok.Data; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java index d2cd6fc8..d8808ddd 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/monitor/DynamicThreadPoolMonitorExecutor.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.monitor; +package cn.hippo4j.config.springboot.starter.monitor; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.toolkit.StringUtil; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; import cn.hippo4j.core.executor.support.ThreadFactoryBuilder; import cn.hippo4j.common.spi.DynamicThreadPoolServiceLoader; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; import cn.hippo4j.monitor.base.DynamicThreadPoolMonitor; import cn.hippo4j.monitor.base.ThreadPoolMonitor; import com.google.common.collect.Lists; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java index ecbaeb8c..e4ae0a30 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/notify/CoreNotifyConfigBuilder.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/notify/CoreNotifyConfigBuilder.java @@ -15,13 +15,13 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.notify; +package cn.hippo4j.config.springboot.starter.notify; import cn.hippo4j.common.toolkit.CollectionUtil; import cn.hippo4j.common.toolkit.StringUtil; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; -import cn.hippo4j.core.springboot.starter.config.NotifyPlatformProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; +import cn.hippo4j.config.springboot.starter.config.NotifyPlatformProperties; import cn.hippo4j.message.service.AlarmControlHandler; import cn.hippo4j.message.dto.NotifyConfigDTO; import cn.hippo4j.message.api.NotifyConfigBuilder; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/AbstractConfigParser.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/AbstractConfigParser.java similarity index 95% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/AbstractConfigParser.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/AbstractConfigParser.java index 72822277..38b0c162 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/AbstractConfigParser.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/AbstractConfigParser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; /** * Abstract config parser diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigFileTypeEnum.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigFileTypeEnum.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigFileTypeEnum.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigFileTypeEnum.java index 91819d60..ae727644 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigFileTypeEnum.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigFileTypeEnum.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; import lombok.Getter; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParser.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParser.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParser.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParser.java index e0a98ba7..9b182086 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParser.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; import java.io.IOException; import java.util.List; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParserHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParserHandler.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParserHandler.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParserHandler.java index 0a02d466..c1ae1182 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/ConfigParserHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/ConfigParserHandler.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; import com.google.common.collect.Lists; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/PropertiesConfigParser.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/PropertiesConfigParser.java similarity index 96% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/PropertiesConfigParser.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/PropertiesConfigParser.java index 9fb118d2..211fe13c 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/PropertiesConfigParser.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/PropertiesConfigParser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; import com.google.common.collect.Lists; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/YamlConfigParser.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/YamlConfigParser.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/YamlConfigParser.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/YamlConfigParser.java index 6f78ee23..75a8abbb 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/parser/YamlConfigParser.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/parser/YamlConfigParser.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.parser; +package cn.hippo4j.config.springboot.starter.parser; import com.google.common.collect.Lists; import com.google.common.collect.Maps; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java similarity index 90% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java index a1ca9968..91defbc4 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/AbstractCoreThreadPoolDynamicRefresh.java @@ -15,15 +15,15 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; import cn.hippo4j.common.api.ThreadPoolDynamicRefresh; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.toolkit.CollectionUtil; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.parser.ConfigParserHandler; +import cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEvent; import cn.hippo4j.core.executor.support.ThreadPoolBuilder; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.parser.ConfigParserHandler; -import cn.hippo4j.core.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEvent; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ApolloRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ApolloRefresherHandler.java similarity index 93% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ApolloRefresherHandler.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ApolloRefresherHandler.java index 177b4bb6..4c372684 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ApolloRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ApolloRefresherHandler.java @@ -15,8 +15,9 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigChangeListener; import com.ctrip.framework.apollo.ConfigFile; @@ -29,8 +30,6 @@ import org.springframework.beans.factory.annotation.Value; import java.util.Map; -import static cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties.PREFIX; - /** * Apollo refresher handler. */ @@ -52,7 +51,7 @@ public class ApolloRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh ConfigFileFormat configFileFormat = ConfigFileFormat.fromString(bootstrapConfigProperties.getConfigFileType().getValue()); ConfigFile configFile = ConfigService.getConfigFile(namespace, configFileFormat); Map newChangeValueMap = Maps.newHashMap(); - configChangeEvent.changedKeys().stream().filter(each -> each.contains(PREFIX)).forEach(each -> { + configChangeEvent.changedKeys().stream().filter(each -> each.contains(BootstrapConfigProperties.PREFIX)).forEach(each -> { ConfigChange change = configChangeEvent.getChange(each); String newValue = change.getNewValue(); newChangeValueMap.put(each, newValue); diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java similarity index 88% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java index 66848026..e8ab3d83 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/BootstrapCorePropertiesBinderAdapt.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; import cn.hippo4j.common.toolkit.CollectionUtil; import cn.hippo4j.common.toolkit.StringUtil; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.DynamicThreadPoolNotifyProperties; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; -import cn.hippo4j.core.springboot.starter.config.NotifyPlatformProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.DynamicThreadPoolNotifyProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; +import cn.hippo4j.config.springboot.starter.config.NotifyPlatformProperties; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import com.google.common.collect.Lists; @@ -35,8 +35,6 @@ import org.springframework.boot.context.properties.source.MapConfigurationProper import java.util.List; import java.util.Map; -import static cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties.PREFIX; - /** * Bootstrap core properties binder adapt. */ @@ -54,7 +52,7 @@ public class BootstrapCorePropertiesBinderAdapt { try { ConfigurationPropertySource sources = new MapConfigurationPropertySource(configInfo); Binder binder = new Binder(sources); - bindableCoreProperties = binder.bind(PREFIX, Bindable.ofInstance(bootstrapConfigProperties)).get(); + bindableCoreProperties = binder.bind(BootstrapConfigProperties.PREFIX, Bindable.ofInstance(bootstrapConfigProperties)).get(); } catch (Exception ex) { try { Class.forName("org.springframework.boot.context.properties.bind.Binder"); @@ -80,11 +78,11 @@ public class BootstrapCorePropertiesBinderAdapt { configInfo.forEach((key, val) -> { boolean containFlag = key != null && StringUtil.isNotBlank((String) key) - && (((String) key).indexOf(PREFIX + ".executors") != -1 - || ((String) key).indexOf(PREFIX + ".notify-platforms") != -1 - || ((String) key).indexOf(PREFIX + ".notifyPlatforms") != -1); + && (((String) key).indexOf(BootstrapConfigProperties.PREFIX + ".executors") != -1 + || ((String) key).indexOf(BootstrapConfigProperties.PREFIX + ".notify-platforms") != -1 + || ((String) key).indexOf(BootstrapConfigProperties.PREFIX + ".notifyPlatforms") != -1); if (containFlag) { - String targetKey = key.toString().replace(PREFIX + ".", ""); + String targetKey = key.toString().replace(BootstrapConfigProperties.PREFIX + ".", ""); targetMap.put(targetKey, val); } }); diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/EtcdRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/EtcdRefresherHandler.java new file mode 100644 index 00000000..991d8b17 --- /dev/null +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/EtcdRefresherHandler.java @@ -0,0 +1,122 @@ +/* + * 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.config.springboot.starter.refresher; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Objects; + +import cn.hippo4j.common.toolkit.JSONUtil; +import cn.hippo4j.common.toolkit.StringUtil; +import io.etcd.jetcd.ByteSequence; +import io.etcd.jetcd.Client; +import io.etcd.jetcd.ClientBuilder; +import io.etcd.jetcd.KeyValue; +import io.etcd.jetcd.Watch; +import io.etcd.jetcd.watch.WatchEvent; +import io.etcd.jetcd.watch.WatchResponse; +import lombok.extern.slf4j.Slf4j; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + *@author : wh + *@date : 2022/8/30 17:59 + *@description: + */ +@Slf4j +public class EtcdRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh implements ApplicationContextAware { + + private ApplicationContext applicationContext; + + private Client client; + + private static final String ENDPOINTS = "endpoints"; + + private static final String USER = "user"; + + private static final String PASSWORD = "password"; + + private static final String CHARSET = "charset"; + + private static final String AUTHORITY = "authority"; + + private static final String KEY = "key"; + + @Override + public void afterPropertiesSet() throws Exception { + Map etcd = bootstrapConfigProperties.getEtcd(); + String user = etcd.get(USER); + String password = etcd.get(PASSWORD); + String endpoints = etcd.get(ENDPOINTS); + String authority = etcd.get(AUTHORITY); + String key = etcd.get(KEY); + Charset charset = StringUtil.isBlank(etcd.get(CHARSET)) ? StandardCharsets.UTF_8 : Charset.forName(etcd.get(CHARSET)); + + ClientBuilder clientBuilder = Client.builder().endpoints(endpoints.split(",")); + + client = applicationContext.getBean(Client.class); + if (Objects.isNull(client)) { + client = StringUtil.isAllNotEmpty(user, password) ? clientBuilder.user(ByteSequence.from(user, charset)) + .password(ByteSequence.from(password, charset)).authority(authority) + .build() : clientBuilder.build(); + } + + // todo Currently only supports json + KeyValue keyValue = client.getKVClient().get(ByteSequence.from(key, charset)).get().getKvs().get(0); + if (Objects.isNull(keyValue)) { + return; + } + + client.getWatchClient().watch(ByteSequence.from(key, charset), new Watch.Listener() { + + @Override + public void onNext(WatchResponse response) { + WatchEvent watchEvent = response.getEvents().get(0); + WatchEvent.EventType eventType = watchEvent.getEventType(); + // todo Currently only supports json + if (Objects.equals(eventType, WatchEvent.EventType.PUT)) { + KeyValue keyValue1 = watchEvent.getKeyValue(); + String value = keyValue1.getValue().toString(charset); + Map map = JSONUtil.parseObject(value, Map.class); + dynamicRefresh(keyValue1.getKey().toString(charset), map); + } + + } + + @Override + public void onError(Throwable throwable) { + log.error("dynamic thread pool etcd config watcher exception ", throwable); + } + + @Override + public void onCompleted() { + log.info("dynamic thread pool etcd config key refreshed, config key {}", key); + } + }); + + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } +} diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosCloudRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosCloudRefresherHandler.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java index a7eab883..4a473988 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosCloudRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; import cn.hippo4j.common.config.ApplicationContextHolder; import com.alibaba.cloud.nacos.NacosConfigManager; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java similarity index 94% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosRefresherHandler.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java index a1ff78dd..baf0616b 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/NacosRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; import com.alibaba.nacos.api.annotation.NacosInjected; import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.listener.Listener; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ZookeeperRefresherHandler.java similarity index 98% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ZookeeperRefresherHandler.java index e56baa88..2cbe8100 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/ZookeeperRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/ZookeeperRefresherHandler.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher; +package cn.hippo4j.config.springboot.starter.refresher; import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java similarity index 84% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java index 0c30311c..70fd664e 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AdapterExecutorsRefreshListener.java @@ -15,13 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; import cn.hippo4j.adapter.base.ThreadPoolAdapter; import cn.hippo4j.adapter.base.ThreadPoolAdapterParameter; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.toolkit.CollectionUtil; -import cn.hippo4j.core.springboot.starter.config.AdapterExecutorProperties; +import cn.hippo4j.config.springboot.starter.config.AdapterExecutorProperties; +import cn.hippo4j.config.springboot.starter.support.DynamicThreadPoolAdapterRegister; import cn.hutool.core.bean.BeanUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationListener; @@ -32,8 +33,7 @@ import java.util.Map; import java.util.Objects; import static cn.hippo4j.common.constant.Constants.IDENTIFY_SLICER_SYMBOL; -import static cn.hippo4j.core.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.ADAPTER_EXECUTORS_LISTENER; -import static cn.hippo4j.core.springboot.starter.support.DynamicThreadPoolAdapterRegister.ADAPTER_EXECUTORS_MAP; +import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.ADAPTER_EXECUTORS_LISTENER; /** * Adapter executors refresh listener. @@ -51,7 +51,7 @@ public class AdapterExecutorsRefreshListener implements ApplicationListener { if (Objects.equals(val.mark(), each.getMark())) { val.updateThreadPool(BeanUtil.toBean(each, ThreadPoolAdapterParameter.class)); - ADAPTER_EXECUTORS_MAP.put(buildKey, each); + DynamicThreadPoolAdapterRegister.ADAPTER_EXECUTORS_MAP.put(buildKey, each); } }); } diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java index 6f5f0d1b..8dbc02b3 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/DynamicThreadPoolRefreshListener.java @@ -15,22 +15,22 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; import cn.hippo4j.common.executor.support.BlockingQueueTypeEnum; import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum; import cn.hippo4j.common.executor.support.ResizableCapacityLinkedBlockingQueue; import cn.hippo4j.common.toolkit.CollectionUtil; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; +import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder; +import cn.hippo4j.config.springboot.starter.support.GlobalCoreThreadPoolManage; import cn.hippo4j.core.executor.DynamicThreadPoolExecutor; import cn.hippo4j.core.executor.ThreadPoolNotifyAlarmHandler; import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage; import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.support.AbstractDynamicExecutorSupport; import cn.hippo4j.core.proxy.RejectedProxyUtil; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; -import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder; -import cn.hippo4j.core.springboot.starter.support.GlobalCoreThreadPoolManage; import cn.hippo4j.message.dto.NotifyConfigDTO; import cn.hippo4j.message.request.ChangeParameterNotifyRequest; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService; @@ -52,7 +52,7 @@ import java.util.concurrent.atomic.AtomicLong; import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_DELIMITER; import static cn.hippo4j.common.constant.ChangeThreadPoolConstants.CHANGE_THREAD_POOL_TEXT; -import static cn.hippo4j.core.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.EXECUTORS_LISTENER; +import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.EXECUTORS_LISTENER; /** * Dynamic thread-pool refresh listener. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java similarity index 90% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java index d35f7ec4..66d20194 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEvent.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; import lombok.Getter; import lombok.Setter; import org.springframework.context.ApplicationEvent; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java similarity index 94% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java index 64838b70..1b7106ad 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/Hippo4jConfigDynamicRefreshEventOrder.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; /** * Hippo-4j config dynamic refresh event order. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/PlatformsRefreshListener.java similarity index 86% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsRefreshListener.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/PlatformsRefreshListener.java index c73ea1a0..ec380bad 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/PlatformsRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/PlatformsRefreshListener.java @@ -15,14 +15,14 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; import cn.hippo4j.common.config.ApplicationContextHolder; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; +import cn.hippo4j.config.springboot.starter.notify.CoreNotifyConfigBuilder; import cn.hippo4j.core.executor.DynamicThreadPoolWrapper; import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; -import cn.hippo4j.core.springboot.starter.notify.CoreNotifyConfigBuilder; import cn.hippo4j.message.dto.NotifyConfigDTO; import cn.hippo4j.message.service.Hippo4jBaseSendMessageService; import org.springframework.context.ApplicationListener; @@ -31,7 +31,7 @@ import org.springframework.core.annotation.Order; import java.util.List; import java.util.Map; -import static cn.hippo4j.core.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.PLATFORMS_LISTENER; +import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.PLATFORMS_LISTENER; /** * Platforms refresh listener. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/WebExecutorRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/WebExecutorRefreshListener.java similarity index 92% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/WebExecutorRefreshListener.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/WebExecutorRefreshListener.java index 05bcbb1e..5e01320c 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/WebExecutorRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/WebExecutorRefreshListener.java @@ -15,22 +15,22 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.refresher.event; +package cn.hippo4j.config.springboot.starter.refresher.event; import cn.hippo4j.adapter.web.WebThreadPoolHandlerChoose; import cn.hippo4j.adapter.web.WebThreadPoolService; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.model.ThreadPoolParameter; import cn.hippo4j.common.model.ThreadPoolParameterInfo; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.WebThreadPoolProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.WebThreadPoolProperties; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationListener; import org.springframework.core.annotation.Order; import java.util.Objects; -import static cn.hippo4j.core.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.WEB_EXECUTOR_LISTENER; +import static cn.hippo4j.config.springboot.starter.refresher.event.Hippo4jConfigDynamicRefreshEventOrder.WEB_EXECUTOR_LISTENER; /** * Web executor refresh listener. diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolAdapterRegister.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java similarity index 90% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolAdapterRegister.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java index 932aad15..5d9f6979 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolAdapterRegister.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolAdapterRegister.java @@ -15,11 +15,11 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.support; +package cn.hippo4j.config.springboot.starter.support; import cn.hippo4j.common.toolkit.CollectionUtil; -import cn.hippo4j.core.springboot.starter.config.AdapterExecutorProperties; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.AdapterExecutorProperties; import com.google.common.collect.Maps; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolConfigService.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolConfigService.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolConfigService.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolConfigService.java index eafa4530..4b3eee1b 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolConfigService.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolConfigService.java @@ -15,19 +15,19 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.support; +package cn.hippo4j.config.springboot.starter.support; import cn.hippo4j.common.model.register.DynamicThreadPoolRegisterParameter; import cn.hippo4j.common.model.register.DynamicThreadPoolRegisterWrapper; import cn.hippo4j.common.model.register.notify.DynamicThreadPoolRegisterCoreNotifyParameter; import cn.hippo4j.common.toolkit.BooleanUtil; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; import cn.hippo4j.core.executor.DynamicThreadPoolWrapper; import cn.hippo4j.core.executor.manage.GlobalNotifyAlarmManage; import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.common.executor.support.BlockingQueueTypeEnum; import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum; import cn.hippo4j.core.executor.support.service.AbstractDynamicThreadPoolService; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; import java.util.concurrent.ThreadPoolExecutor; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolPostProcessor.java similarity index 97% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolPostProcessor.java index d00fe5a8..c4a92165 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/DynamicThreadPoolPostProcessor.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/DynamicThreadPoolPostProcessor.java @@ -15,12 +15,15 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.support; +package cn.hippo4j.config.springboot.starter.support; import cn.hippo4j.common.config.ApplicationContextHolder; import cn.hippo4j.common.executor.support.BlockingQueueTypeEnum; import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum; import cn.hippo4j.common.toolkit.StringUtil; +import cn.hippo4j.config.springboot.starter.config.BootstrapConfigProperties; +import cn.hippo4j.config.springboot.starter.config.DynamicThreadPoolNotifyProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; import cn.hippo4j.core.executor.DynamicThreadPool; import cn.hippo4j.core.executor.DynamicThreadPoolExecutor; import cn.hippo4j.core.executor.DynamicThreadPoolWrapper; @@ -29,9 +32,6 @@ import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.support.CommonDynamicThreadPool; import cn.hippo4j.core.executor.support.ThreadPoolBuilder; import cn.hippo4j.core.executor.support.adpter.DynamicThreadPoolAdapterChoose; -import cn.hippo4j.core.springboot.starter.config.BootstrapConfigProperties; -import cn.hippo4j.core.springboot.starter.config.DynamicThreadPoolNotifyProperties; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; import cn.hippo4j.core.toolkit.inet.DynamicThreadPoolAnnotationUtil; import cn.hippo4j.message.service.ThreadPoolNotifyAlarm; import lombok.AllArgsConstructor; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/GlobalCoreThreadPoolManage.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/GlobalCoreThreadPoolManage.java similarity index 93% rename from hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/GlobalCoreThreadPoolManage.java rename to hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/GlobalCoreThreadPoolManage.java index 6c665023..fc8b88a9 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/support/GlobalCoreThreadPoolManage.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/support/GlobalCoreThreadPoolManage.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package cn.hippo4j.core.springboot.starter.support; +package cn.hippo4j.config.springboot.starter.support; -import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; +import cn.hippo4j.config.springboot.starter.config.ExecutorProperties; import com.google.common.collect.Maps; import java.util.Map; diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/EtcdRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/EtcdRefresherHandler.java deleted file mode 100644 index 0754752b..00000000 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/EtcdRefresherHandler.java +++ /dev/null @@ -1,105 +0,0 @@ -package cn.hippo4j.core.springboot.starter.refresher; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.Objects; - -import cn.hippo4j.common.toolkit.JSONUtil; -import cn.hippo4j.common.toolkit.StringUtil; -import io.etcd.jetcd.ByteSequence; -import io.etcd.jetcd.Client; -import io.etcd.jetcd.ClientBuilder; -import io.etcd.jetcd.KeyValue; -import io.etcd.jetcd.Watch; -import io.etcd.jetcd.watch.WatchEvent; -import io.etcd.jetcd.watch.WatchResponse; -import lombok.extern.slf4j.Slf4j; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -/** - *@author : wh - *@date : 2022/8/30 17:59 - *@description: - */ -@Slf4j -public class EtcdRefresherHandler extends AbstractCoreThreadPoolDynamicRefresh implements ApplicationContextAware { - - private ApplicationContext applicationContext; - - private Client client; - - private static final String ENDPOINTS = "endpoints"; - - private static final String USER = "user"; - - private static final String PASSWORD = "password"; - - private static final String CHARSET = "charset"; - - private static final String AUTHORITY = "authority"; - - private static final String KEY = "key"; - - - @Override - public void afterPropertiesSet() throws Exception { - Map etcd = bootstrapConfigProperties.getEtcd(); - String user = etcd.get(USER); - String password = etcd.get(PASSWORD); - String endpoints = etcd.get(ENDPOINTS); - String authority = etcd.get(AUTHORITY); - String key = etcd.get(KEY); - Charset charset = StringUtil.isBlank(etcd.get(CHARSET)) ? StandardCharsets.UTF_8 : Charset.forName(etcd.get(CHARSET)); - - ClientBuilder clientBuilder = Client.builder().endpoints(endpoints.split(",")); - - client = applicationContext.getBean(Client.class); - if (Objects.isNull(client)) { - client = StringUtil.isAllNotEmpty(user, password) ? clientBuilder.user(ByteSequence.from(user, charset)) - .password(ByteSequence.from(password, charset)).authority(authority) - .build() : clientBuilder.build(); - } - - // todo Currently only supports json - KeyValue keyValue = client.getKVClient().get(ByteSequence.from(key, charset)).get().getKvs().get(0); - if (Objects.isNull(keyValue)) { - return; - } - - client.getWatchClient().watch(ByteSequence.from(key, charset), new Watch.Listener() { - @Override - public void onNext(WatchResponse response) { - WatchEvent watchEvent = response.getEvents().get(0); - WatchEvent.EventType eventType = watchEvent.getEventType(); - // todo Currently only supports json - if (Objects.equals(eventType, WatchEvent.EventType.PUT)) { - KeyValue keyValue1 = watchEvent.getKeyValue(); - String value = keyValue1.getValue().toString(charset); - Map map = JSONUtil.parseObject(value, Map.class); - dynamicRefresh(keyValue1.getKey().toString(charset), map); - } - - } - - @Override - public void onError(Throwable throwable) { - log.error("dynamic thread pool etcd config watcher exception ", throwable); - } - - @Override - public void onCompleted() { - log.info("dynamic thread pool etcd config key refreshed, config key {}", key); - } - }); - - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } -} diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/resources/META-INF/spring.factories b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/resources/META-INF/spring.factories index 203972c7..5f39cf76 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/resources/META-INF/spring.factories @@ -1 +1 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=cn.hippo4j.core.springboot.starter.config.DynamicThreadPoolCoreAutoConfiguration +org.springframework.boot.autoconfigure.EnableAutoConfiguration=cn.hippo4j.config.springboot.starter.config.DynamicThreadPoolCoreAutoConfiguration