diff --git a/README.md b/README.md index 80a6bb4a..4319d233 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Hippo-4J 获得了一些宝贵的荣誉,肯定了 Hippo-4J 作为一款开源 Hippo-4J 获得的成就属于每一位对 Hippo-4J 做出过贡献的成员,感谢各位的贡献。 -如果屏幕前的同学有意提交 Hippo-4J,请参考 [good first issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 或者 [good first issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+pro+issue%22) 任务列表。 +如果屏幕前的同学有意提交 Hippo-4J,请参考 [good first issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) 或者 [good pro issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+pro+issue%22) 任务列表。 diff --git a/docs/docs/community/powered-by.md b/docs/docs/community/powered-by.md index ced23458..301f9e89 100644 --- a/docs/docs/community/powered-by.md +++ b/docs/docs/community/powered-by.md @@ -12,7 +12,7 @@ sidebar_position: 3 ## 谁在使用 Hippo4J -共计 16+ 家公司生产接入 Hippo4J。按照公司登记时间排序。 +共计 18+ 家公司生产接入 Hippo4J。按照公司登记时间排序。 - [身边云](https://serviceshare.com) - [Medbanks](https://www.medbanks.cn) @@ -30,3 +30,5 @@ sidebar_position: 3 - [众合云科(51社保)](https://home.101hr.com/) - [好货云店](https://pc.haohuoyundian.com/) - [斗象科技](https://www.tophant.com/) +- [深圳航天信息有限公司](http://sz.aisino.com/) +- [新东方教育科技集团](https://www.xdf.cn/) diff --git a/docs/docs/user_docs/getting-started/hippo4j-adapter.md b/docs/docs/user_docs/getting-started/hippo4j-adapter.md index 1335beb6..807cc8cc 100644 --- a/docs/docs/user_docs/getting-started/hippo4j-adapter.md +++ b/docs/docs/user_docs/getting-started/hippo4j-adapter.md @@ -53,9 +53,9 @@ Hippo4J Server 仅需要引入上述 Jar 包,即可在 Hippo4J Server 的控 ![](https://images-machen.oss-cn-beijing.aliyuncs.com/image-20220531194810047.png) -## Hippo4J Core +## Hippo4J Config -Hippo4J Core 除了依赖上述适配 Jar 包外,还需要在配置中心添加以下配置项。 +Hippo4J Config 除了依赖上述适配 Jar 包外,还需要在配置中心添加以下配置项。 ```yaml spring: diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index d5d60cd7..50df8518 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -64,7 +64,7 @@ const config = { // content: `👉 《小马哥的代码实战课》官方知识星球来啦!!!`, }, navbar: { - title: 'hippoforjava', + title: 'HIPPO-4J', logo: { alt: 'HIPPO-4J 动态可观测线程池框架', src: 'img/web.png', diff --git a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/UndertowWebThreadPoolHandler.java b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/UndertowWebThreadPoolHandler.java index bfdc5b7d..90ba9b7f 100644 --- a/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/UndertowWebThreadPoolHandler.java +++ b/hippo4j-adapter/hippo4j-adapter-web/src/main/java/cn/hippo4j/adapter/web/UndertowWebThreadPoolHandler.java @@ -27,7 +27,7 @@ import cn.hippo4j.core.executor.DynamicThreadPoolExecutor; import cn.hutool.core.date.DateUtil; import io.undertow.Undertow; import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.web.embedded.undertow.UndertowWebServer; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServer; import org.springframework.boot.web.server.WebServer; import org.springframework.util.ReflectionUtils; import org.xnio.Options; @@ -50,11 +50,12 @@ public class UndertowWebThreadPoolHandler extends AbstractWebThreadPoolService { @Override protected Executor getWebThreadPoolByServer(WebServer webServer) { // There is no need to consider reflection performance because the fetch is a singleton. - UndertowWebServer undertowWebServer = (UndertowWebServer) webServer; - Field undertowField = ReflectionUtils.findField(UndertowWebServer.class, UNDERTOW_NAME); + // Springboot 2-3 version, can directly through reflection to obtain the undertow property + UndertowServletWebServer undertowServletWebServer = (UndertowServletWebServer) webServer; + Field undertowField = ReflectionUtils.findField(UndertowServletWebServer.class, UNDERTOW_NAME); ReflectionUtils.makeAccessible(undertowField); - Undertow undertow = (Undertow) ReflectionUtils.getField(undertowField, undertowWebServer); + Undertow undertow = (Undertow) ReflectionUtils.getField(undertowField, undertowServletWebServer); return Objects.isNull(undertow) ? null : undertow.getWorker(); } diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/JSONUtil.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/JSONUtil.java index f3938ec6..56af7f81 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/JSONUtil.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/JSONUtil.java @@ -33,7 +33,6 @@ public class JSONUtil { if (object == null) { return null; } - return JSON_FACADE.toJSONString(object); } @@ -41,7 +40,6 @@ public class JSONUtil { if (StringUtil.isBlank(text)) { return null; } - return JSON_FACADE.parseObject(text, clazz); } @@ -49,7 +47,6 @@ public class JSONUtil { if (StringUtil.isBlank(text)) { return null; } - return JSON_FACADE.parseObject(text, valueTypeRef); } @@ -57,7 +54,6 @@ public class JSONUtil { if (StringUtil.isBlank(text)) { return null; } - return JSON_FACADE.parseArray(text, clazz); } } diff --git a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/ArrayUtilTest.java b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/ArrayUtilTest.java index c237c461..358dfd9f 100644 --- a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/ArrayUtilTest.java +++ b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/ArrayUtilTest.java @@ -17,8 +17,13 @@ package cn.hippo4j.common.toolkit; +import cn.hippo4j.common.function.Matcher; +import com.google.common.base.Strings; +import org.checkerframework.checker.units.qual.A; import org.junit.Test; +import java.lang.reflect.Array; + public class ArrayUtilTest { @Test @@ -29,21 +34,39 @@ public class ArrayUtilTest { @Test public void assertIsNotEmpty() { - + String[] array = new String[0]; + Assert.isTrue(!ArrayUtil.isNotEmpty(array)); } @Test public void assertFirstMatch() { + Matcher matcher = (str) -> "1".equalsIgnoreCase(str); + String[] array = new String[0]; + Assert.isTrue(Strings.isNullOrEmpty(ArrayUtil.firstMatch(matcher, array))); + + array = new String[]{"0"}; + Assert.isTrue(Strings.isNullOrEmpty(ArrayUtil.firstMatch(matcher, array))); + + array = new String[]{"1"}; + Assert.isTrue(!Strings.isNullOrEmpty(ArrayUtil.firstMatch(matcher, array))); } @Test public void assertAddAll() { + String[] array = new String[]{"1"}; + Assert.isTrue(ArrayUtil.addAll(array, null).length == 1); + Assert.isTrue(ArrayUtil.addAll(null, array).length == 1); + Assert.isTrue(ArrayUtil.addAll(array, new String[]{"1"}).length == 2); } @Test public void assertClone() { + Assert.isNull(ArrayUtil.clone(null)); + String[] array = new String[0]; + Assert.isTrue(array != ArrayUtil.clone(array)); + Assert.isTrue(array.length == ArrayUtil.clone(array).length); } } diff --git a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CalculateUtilTest.java b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CalculateUtilTest.java index 55ca885b..715c71c6 100644 --- a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CalculateUtilTest.java +++ b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CalculateUtilTest.java @@ -23,6 +23,8 @@ public class CalculateUtilTest { @Test public void assertDivide() { - + Assert.isTrue(CalculateUtil.divide(200, 100) == 200); + Assert.isTrue(CalculateUtil.divide(100, 200) == 50); + Assert.isTrue(CalculateUtil.divide(100, 100) == 100); } } diff --git a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CollectionUtilTest.java b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CollectionUtilTest.java index f2e47338..b0be6add 100644 --- a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CollectionUtilTest.java +++ b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/CollectionUtilTest.java @@ -17,22 +17,81 @@ package cn.hippo4j.common.toolkit; +import com.google.common.collect.Maps; +import org.assertj.core.util.Lists; import org.junit.Test; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + public class CollectionUtilTest { @Test public void assertGetFirst() { + Assert.isNull(CollectionUtil.getFirst(null)); + String first = CollectionUtil.getFirst(Lists.newArrayList("1", "2")); + Assert.notEmpty(first); } @Test public void assertIsEmpty() { + List list = null; + Assert.isTrue(CollectionUtil.isEmpty(list)); + + list = Lists.newArrayList(); + Assert.isTrue(CollectionUtil.isEmpty(list)); + + list = Lists.newArrayList("1"); + Assert.isTrue(!CollectionUtil.isEmpty(list)); + + Map map = null; + Assert.isTrue(CollectionUtil.isEmpty(map)); + + map = Maps.newHashMap(); + Assert.isTrue(CollectionUtil.isEmpty(map)); + + map.put("key", "value"); + Assert.isTrue(!CollectionUtil.isEmpty(map)); + + Iterator iterator = null; + Assert.isTrue(CollectionUtil.isEmpty(iterator)); + + iterator = Lists.emptyList().iterator(); + Assert.isTrue(CollectionUtil.isEmpty(iterator)); + iterator = Lists.newArrayList("1").iterator(); + Assert.isTrue(!CollectionUtil.isEmpty(iterator)); } @Test public void assertIsNotEmpty() { + List list = null; + Assert.isTrue(!CollectionUtil.isNotEmpty(list)); + + list = Lists.newArrayList(); + Assert.isTrue(!CollectionUtil.isNotEmpty(list)); + + list = Lists.newArrayList("1"); + Assert.isTrue(CollectionUtil.isNotEmpty(list)); + + Map map = null; + Assert.isTrue(!CollectionUtil.isNotEmpty(map)); + + map = Maps.newHashMap(); + Assert.isTrue(!CollectionUtil.isNotEmpty(map)); + + map.put("key", "value"); + Assert.isTrue(CollectionUtil.isNotEmpty(map)); + + Iterator iterator = null; + Assert.isTrue(!CollectionUtil.isNotEmpty(iterator)); + + iterator = Lists.emptyList().iterator(); + Assert.isTrue(!CollectionUtil.isNotEmpty(iterator)); + iterator = Lists.newArrayList("1").iterator(); + Assert.isTrue(CollectionUtil.isNotEmpty(iterator)); } } diff --git a/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java new file mode 100644 index 00000000..62ea2f17 --- /dev/null +++ b/hippo4j-common/src/test/java/cn/hippo4j/common/toolkit/JSONUtilTest.java @@ -0,0 +1,84 @@ +/* + * 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.common.toolkit; + +import com.fasterxml.jackson.core.type.TypeReference; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +/** + * JSON util test. + */ +public class JSONUtilTest { + + private static final Foo EXPECTED_FOO = new Foo(1, "foo1", new Foo(2, "foo2", null)); + private static final List EXPECTED_FOO_ARRAY = Arrays.asList(EXPECTED_FOO, EXPECTED_FOO); + private static final String EXPECTED_FOO_JSON = "{\"id\":1,\"name\":\"foo1\",\"foo\":{\"id\":2,\"name\":\"foo2\"}}"; + private static final String EXPECTED_FOO_JSON_ARRAY = "[" + EXPECTED_FOO_JSON + "," + EXPECTED_FOO_JSON + "]"; + + @Test + public void assertToJSONString() { + Assert.assertNull(JSONUtil.toJSONString(null)); + Assert.assertEquals(EXPECTED_FOO_JSON, JSONUtil.toJSONString(EXPECTED_FOO)); + } + + @Test + public void assertParseObject() { + Assert.assertNull(JSONUtil.parseObject(null, Foo.class)); + Assert.assertNull(JSONUtil.parseObject(" ", Foo.class)); + Assert.assertEquals(EXPECTED_FOO, JSONUtil.parseObject(EXPECTED_FOO_JSON, Foo.class)); + } + + @Test + public void assertParseObjectTypeReference() { + Assert.assertNull(JSONUtil.parseObject(null, new TypeReference>() {})); + Assert.assertNull(JSONUtil.parseObject(" ", new TypeReference>() {})); + Assert.assertEquals( + EXPECTED_FOO_ARRAY, + JSONUtil.parseObject(EXPECTED_FOO_JSON_ARRAY, new TypeReference>() {}) + ); + } + + @Test + public void assertParseArray() { + Assert.assertNull(JSONUtil.parseArray(null, Foo.class)); + Assert.assertNull(JSONUtil.parseArray(" ", Foo.class)); + Assert.assertEquals( + EXPECTED_FOO_ARRAY, + JSONUtil.parseArray(EXPECTED_FOO_JSON_ARRAY, Foo.class) + ); + } + + @EqualsAndHashCode + @AllArgsConstructor + @NoArgsConstructor + @Data + private static class Foo { + private Integer id; + private String name; + private Foo foo; + } + +} 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-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RunStateHandlerTest.java b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RunStateHandlerTest.java index c29c682a..a07f8624 100644 --- a/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RunStateHandlerTest.java +++ b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RunStateHandlerTest.java @@ -45,8 +45,9 @@ public class RunStateHandlerTest { @Resource private ThreadPoolExecutor messageProduceDynamicThreadPool; - /*@Resource - private ThreadPoolTaskExecutor testSpringThreadPoolTaskExecutor;*/ + /* + * @Resource private ThreadPoolTaskExecutor testSpringThreadPoolTaskExecutor; + */ private final ThreadPoolExecutor runStateHandlerTestExecutor = new ThreadPoolExecutor( 4, 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 95% 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..d939e371 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,16 @@ * 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 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..e69de29b 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