From 3660b0dfaacbec1a0ceee29f793cf87ec0a837a6 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Sun, 11 Jul 2021 01:23:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=20Dynamic=20Thre?= =?UTF-8?q?adPool=20Starter=20=E5=8C=85=E7=BA=A7=E7=9B=AE=E5=BD=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../starter/{common => config}/CommonThreadPool.java | 2 +- .../starter/config/DynamicThreadPoolAutoConfiguration.java | 4 ++-- .../starter/{banner => config}/DynamicThreadPoolBanner.java | 2 +- .../threadpool/starter/{adapter => core}/ConfigAdapter.java | 2 +- .../starter/{adapter => core}/ThreadPoolConfigAdapter.java | 3 +-- .../starter/{operation => core}/ThreadPoolOperation.java | 3 +-- .../{operation => core}/ThreadPoolSubscribeCallback.java | 2 +- .../threadpool/starter/handler/ThreadPoolChangeHandler.java | 2 +- .../threadpool/starter/listener/ThreadPoolRunListener.java | 4 ++-- .../starter/{builder => toolkit/thread}/Builder.java | 2 +- .../threadpool/starter/toolkit/thread/QueueTypeEnum.java | 3 +-- .../thread}/ResizableCapacityLinkedBlockIngQueue.java | 2 +- .../starter/toolkit/thread/ThreadFactoryBuilder.java | 2 -- .../threadpool/starter/toolkit/thread/ThreadPoolBuilder.java | 1 - .../threadpool/starter/wrap/DynamicThreadPoolWrap.java | 2 +- .../test/ResizableCapacityLinkedBlockIngQueueTest.java | 2 +- 16 files changed, 16 insertions(+), 22 deletions(-) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{common => config}/CommonThreadPool.java (95%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{banner => config}/DynamicThreadPoolBanner.java (97%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{adapter => core}/ConfigAdapter.java (88%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{adapter => core}/ThreadPoolConfigAdapter.java (93%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{operation => core}/ThreadPoolOperation.java (91%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{operation => core}/ThreadPoolSubscribeCallback.java (82%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{builder => toolkit/thread}/Builder.java (82%) rename dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/{core => toolkit/thread}/ResizableCapacityLinkedBlockIngQueue.java (93%) diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/common/CommonThreadPool.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/CommonThreadPool.java similarity index 95% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/common/CommonThreadPool.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/CommonThreadPool.java index 4b3608f1..287f3892 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/common/CommonThreadPool.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/CommonThreadPool.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.common; +package io.dynamic.threadpool.starter.config; import io.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum; import io.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java index 6c298354..013d569c 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolAutoConfiguration.java @@ -1,13 +1,13 @@ package io.dynamic.threadpool.starter.config; import io.dynamic.threadpool.common.config.CommonConfiguration; -import io.dynamic.threadpool.starter.adapter.ThreadPoolConfigAdapter; +import io.dynamic.threadpool.starter.core.ThreadPoolConfigAdapter; import io.dynamic.threadpool.starter.controller.PoolRunStateController; import io.dynamic.threadpool.starter.core.ConfigService; import io.dynamic.threadpool.starter.core.ThreadPoolConfigService; import io.dynamic.threadpool.starter.enable.DynamicThreadPoolMarkerConfiguration; import io.dynamic.threadpool.starter.listener.ThreadPoolRunListener; -import io.dynamic.threadpool.starter.operation.ThreadPoolOperation; +import io.dynamic.threadpool.starter.core.ThreadPoolOperation; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/banner/DynamicThreadPoolBanner.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolBanner.java similarity index 97% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/banner/DynamicThreadPoolBanner.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolBanner.java index 82ecbe01..8f73d752 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/banner/DynamicThreadPoolBanner.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/config/DynamicThreadPoolBanner.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.banner; +package io.dynamic.threadpool.starter.config; import org.springframework.boot.ansi.AnsiColor; import org.springframework.boot.ansi.AnsiOutput; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ConfigAdapter.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ConfigAdapter.java similarity index 88% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ConfigAdapter.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ConfigAdapter.java index f834c658..de734729 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ConfigAdapter.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ConfigAdapter.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.adapter; +package io.dynamic.threadpool.starter.core; import io.dynamic.threadpool.starter.core.ThreadPoolDynamicRefresh; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ThreadPoolConfigAdapter.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolConfigAdapter.java similarity index 93% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ThreadPoolConfigAdapter.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolConfigAdapter.java index 9864db92..1c88233c 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/adapter/ThreadPoolConfigAdapter.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolConfigAdapter.java @@ -1,8 +1,7 @@ -package io.dynamic.threadpool.starter.adapter; +package io.dynamic.threadpool.starter.core; import io.dynamic.threadpool.common.config.ApplicationContextHolder; import io.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum; -import io.dynamic.threadpool.starter.operation.ThreadPoolOperation; import io.dynamic.threadpool.starter.toolkit.thread.ThreadPoolBuilder; import io.dynamic.threadpool.starter.wrap.DynamicThreadPoolWrap; import org.springframework.beans.factory.annotation.Autowired; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolOperation.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolOperation.java similarity index 91% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolOperation.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolOperation.java index a7ff6413..3c122599 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolOperation.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolOperation.java @@ -1,7 +1,6 @@ -package io.dynamic.threadpool.starter.operation; +package io.dynamic.threadpool.starter.core; import io.dynamic.threadpool.starter.config.DynamicThreadPoolProperties; -import io.dynamic.threadpool.starter.core.ConfigService; import io.dynamic.threadpool.starter.listener.Listener; import org.springframework.beans.factory.annotation.Autowired; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolSubscribeCallback.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolSubscribeCallback.java similarity index 82% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolSubscribeCallback.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolSubscribeCallback.java index 904adfb1..23aee20d 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/operation/ThreadPoolSubscribeCallback.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ThreadPoolSubscribeCallback.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.operation; +package io.dynamic.threadpool.starter.core; /** * ThreadPoolSubscribeCallback. diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/handler/ThreadPoolChangeHandler.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/handler/ThreadPoolChangeHandler.java index 101598a2..c9efc3f9 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/handler/ThreadPoolChangeHandler.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/handler/ThreadPoolChangeHandler.java @@ -1,7 +1,7 @@ package io.dynamic.threadpool.starter.handler; import io.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum; -import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue; +import io.dynamic.threadpool.starter.toolkit.thread.ResizableCapacityLinkedBlockIngQueue; import lombok.extern.slf4j.Slf4j; import java.util.Objects; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/listener/ThreadPoolRunListener.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/listener/ThreadPoolRunListener.java index 0f18ed79..93d1512c 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/listener/ThreadPoolRunListener.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/listener/ThreadPoolRunListener.java @@ -5,8 +5,8 @@ import io.dynamic.threadpool.common.config.ApplicationContextHolder; import io.dynamic.threadpool.common.constant.Constants; import io.dynamic.threadpool.common.model.PoolParameterInfo; import io.dynamic.threadpool.common.web.base.Result; -import io.dynamic.threadpool.starter.banner.DynamicThreadPoolBanner; -import io.dynamic.threadpool.starter.common.CommonThreadPool; +import io.dynamic.threadpool.starter.config.DynamicThreadPoolBanner; +import io.dynamic.threadpool.starter.config.CommonThreadPool; import io.dynamic.threadpool.starter.config.DynamicThreadPoolProperties; import io.dynamic.threadpool.starter.core.GlobalThreadPoolManage; import io.dynamic.threadpool.starter.toolkit.thread.QueueTypeEnum; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/builder/Builder.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/Builder.java similarity index 82% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/builder/Builder.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/Builder.java index 5900bdb8..10285233 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/builder/Builder.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/Builder.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.builder; +package io.dynamic.threadpool.starter.toolkit.thread; import java.io.Serializable; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/QueueTypeEnum.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/QueueTypeEnum.java index ba32a451..324f4955 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/QueueTypeEnum.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/QueueTypeEnum.java @@ -1,6 +1,5 @@ package io.dynamic.threadpool.starter.toolkit.thread; -import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue; import io.dynamic.threadpool.starter.spi.DynamicTpServiceLoader; import io.dynamic.threadpool.starter.spi.queue.CustomBlockingQueue; @@ -48,7 +47,7 @@ public enum QueueTypeEnum { PRIORITY_BLOCKING_QUEUE(6), /** - * {@link "io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue"} + * {@link "io.dynamic.threadpool.starter.toolkit.thread.ResizableCapacityLinkedBlockIngQueue"} */ RESIZABLE_LINKED_BLOCKING_QUEUE(9); diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ResizableCapacityLinkedBlockIngQueue.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ResizableCapacityLinkedBlockIngQueue.java similarity index 93% rename from dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ResizableCapacityLinkedBlockIngQueue.java rename to dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ResizableCapacityLinkedBlockIngQueue.java index b166fdb2..a9a8021d 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/core/ResizableCapacityLinkedBlockIngQueue.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ResizableCapacityLinkedBlockIngQueue.java @@ -1,4 +1,4 @@ -package io.dynamic.threadpool.starter.core; +package io.dynamic.threadpool.starter.toolkit.thread; import cn.hutool.core.util.ReflectUtil; import lombok.extern.slf4j.Slf4j; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadFactoryBuilder.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadFactoryBuilder.java index 2e55f1bb..eddd8eeb 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadFactoryBuilder.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadFactoryBuilder.java @@ -1,7 +1,5 @@ package io.dynamic.threadpool.starter.toolkit.thread; -import io.dynamic.threadpool.starter.builder.Builder; - import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadPoolBuilder.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadPoolBuilder.java index 4a662709..d86d8dbc 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadPoolBuilder.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/toolkit/thread/ThreadPoolBuilder.java @@ -2,7 +2,6 @@ package io.dynamic.threadpool.starter.toolkit.thread; import io.dynamic.threadpool.common.toolkit.Assert; -import io.dynamic.threadpool.starter.builder.Builder; import java.math.BigDecimal; import java.util.concurrent.*; diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/wrap/DynamicThreadPoolWrap.java b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/wrap/DynamicThreadPoolWrap.java index 1955d899..df516a11 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/wrap/DynamicThreadPoolWrap.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/io/dynamic/threadpool/starter/wrap/DynamicThreadPoolWrap.java @@ -1,6 +1,6 @@ package io.dynamic.threadpool.starter.wrap; -import io.dynamic.threadpool.starter.common.CommonThreadPool; +import io.dynamic.threadpool.starter.config.CommonThreadPool; import lombok.Data; import java.util.concurrent.Callable; diff --git a/dynamic-threadpool-spring-boot-starter/src/test/java/io/dynamic/threadpool/starter/test/ResizableCapacityLinkedBlockIngQueueTest.java b/dynamic-threadpool-spring-boot-starter/src/test/java/io/dynamic/threadpool/starter/test/ResizableCapacityLinkedBlockIngQueueTest.java index e9d9a350..e9945656 100644 --- a/dynamic-threadpool-spring-boot-starter/src/test/java/io/dynamic/threadpool/starter/test/ResizableCapacityLinkedBlockIngQueueTest.java +++ b/dynamic-threadpool-spring-boot-starter/src/test/java/io/dynamic/threadpool/starter/test/ResizableCapacityLinkedBlockIngQueueTest.java @@ -1,6 +1,6 @@ package io.dynamic.threadpool.starter.test; -import io.dynamic.threadpool.starter.core.ResizableCapacityLinkedBlockIngQueue; +import io.dynamic.threadpool.starter.toolkit.thread.ResizableCapacityLinkedBlockIngQueue; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.LinkedBlockingQueue;