diff --git a/hippo4j-core/pom.xml b/hippo4j-core/pom.xml index 677795ab..21c7ba2e 100644 --- a/hippo4j-core/pom.xml +++ b/hippo4j-core/pom.xml @@ -29,7 +29,7 @@ com.aliyun alibaba-dingtalk-service-sdk - + log4j diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/config/BootstrapPropertiesInterface.java b/hippo4j-core/src/main/java/cn/hippo4j/core/config/BootstrapPropertiesInterface.java index 1c5e2d05..f297be67 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/config/BootstrapPropertiesInterface.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/config/BootstrapPropertiesInterface.java @@ -19,9 +19,6 @@ package cn.hippo4j.core.config; /** * Bootstrap properties interface. - * - * @author chen.ma - * @date 2022/2/25 19:01 */ public interface BootstrapPropertiesInterface { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/config/ConfigEmptyException.java b/hippo4j-core/src/main/java/cn/hippo4j/core/config/ConfigEmptyException.java index 913c092e..80584c1f 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/config/ConfigEmptyException.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/config/ConfigEmptyException.java @@ -22,21 +22,18 @@ import lombok.Data; /** * Config empty exception. - * - * @author chen.ma - * @date 2021/11/28 21:58 */ @Data @AllArgsConstructor public class ConfigEmptyException extends RuntimeException { /** - * description + * Description */ private String description; /** - * action + * Action */ private String action; } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/config/UtilAutoConfiguration.java b/hippo4j-core/src/main/java/cn/hippo4j/core/config/UtilAutoConfiguration.java index 3420f044..5c01b9a9 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/config/UtilAutoConfiguration.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/config/UtilAutoConfiguration.java @@ -25,16 +25,13 @@ import org.springframework.context.annotation.Bean; /** * Util auto configuration. - * - * @author Spencer Gibb - * @date 2021/11/12 21:34 */ @EnableConfigurationProperties(InetUtilsProperties.class) public class UtilAutoConfiguration { @Bean @ConditionalOnMissingBean - public InetUtils hippo4JInetUtils(InetUtilsProperties properties) { - return new InetUtils(properties); + public InetUtils hippo4JInetUtils(InetUtilsProperties inetUtilsProperties) { + return new InetUtils(inetUtilsProperties); } } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java index 2160ffe2..101a4e54 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java @@ -30,9 +30,6 @@ import java.util.Objects; /** * Before check configuration. - * - * @author chen.ma - * @date 2021/11/28 22:44 */ @Configuration @AllArgsConstructor diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/EnableDynamicThreadPool.java b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/EnableDynamicThreadPool.java index 9f3c492d..75b2a640 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/EnableDynamicThreadPool.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/EnableDynamicThreadPool.java @@ -23,9 +23,6 @@ import java.lang.annotation.*; /** * Annotation to activate dynamic threadPool related configuration. - * - * @author chen.ma - * @date 2021/7/8 23:28 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/MarkerConfiguration.java b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/MarkerConfiguration.java index 3e8d8f37..de7c762e 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/enable/MarkerConfiguration.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/enable/MarkerConfiguration.java @@ -22,9 +22,6 @@ import org.springframework.context.annotation.Configuration; /** * Marker configuration. - * - * @author chen.ma - * @date 2021/7/8 23:30 */ @Configuration public class MarkerConfiguration { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java index 5bf69441..90f36547 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPool.java @@ -24,9 +24,6 @@ import java.lang.annotation.Target; /** * Dynamic thread pool. - * - * @author chen.ma - * @date 2021/10/13 21:50 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolWrapper.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolWrapper.java index 5141e62c..a83f1c62 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolWrapper.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/DynamicThreadPoolWrapper.java @@ -27,10 +27,7 @@ import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; /** - * Dynamic threadPool wrapper. - * - * @author chen.ma - * @date 2021/6/20 16:55 + * Dynamic thread-pool wrapper. */ @Data public class DynamicThreadPoolWrapper implements DisposableBean { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java index 04e4d8b0..a4452ea4 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java @@ -41,10 +41,7 @@ import java.util.Objects; import java.util.concurrent.*; /** - * Thread pool alarm notify. - * - * @author chen.ma - * @date 2021/8/15 14:13 + * Thread-pool alarm notify. */ @Slf4j @RequiredArgsConstructor @@ -108,9 +105,9 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner return; } ThreadPoolNotifyAlarm threadPoolNotifyAlarm = GlobalNotifyAlarmManage.get(threadPoolId); - BlockingQueue blockIngQueue = threadPoolExecutor.getQueue(); - int queueSize = blockIngQueue.size(); - int capacity = queueSize + blockIngQueue.remainingCapacity(); + BlockingQueue blockingQueue = threadPoolExecutor.getQueue(); + int queueSize = blockingQueue.size(); + int capacity = queueSize + blockingQueue.remainingCapacity(); int divide = CalculateUtil.divide(queueSize, capacity); boolean isSend = threadPoolNotifyAlarm.getIsAlarm() && divide > threadPoolNotifyAlarm.getCapacityAlarm(); diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java index 9ca8c33f..5f680e44 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalNotifyAlarmManage.java @@ -24,9 +24,6 @@ import java.util.concurrent.ConcurrentHashMap; /** * Global notify alarm manage. - * - * @author chen.ma - * @date 2022/2/24 20:12 */ public class GlobalNotifyAlarmManage { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalThreadPoolManage.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalThreadPoolManage.java index a511db10..a10ed0df 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalThreadPoolManage.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/manage/GlobalThreadPoolManage.java @@ -29,9 +29,6 @@ import java.util.concurrent.ThreadPoolExecutor; /** * Global thread-pool manage. - * - * @author chen.ma - * @date 2021/6/20 15:57 */ public class GlobalThreadPoolManage { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/AbstractThreadPoolRuntime.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/AbstractThreadPoolRuntime.java index 401765c9..d584b1d6 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/AbstractThreadPoolRuntime.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/AbstractThreadPoolRuntime.java @@ -31,9 +31,6 @@ import java.util.concurrent.ThreadPoolExecutor; /** * Abstract threadPool runtime info. - * - * @author chen.ma - * @date 2021/12/7 19:44 */ public abstract class AbstractThreadPoolRuntime { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolRunStateHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolRunStateHandler.java index e50f07dd..521143fb 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolRunStateHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolRunStateHandler.java @@ -38,9 +38,6 @@ import static cn.hippo4j.core.toolkit.IdentifyUtil.CLIENT_IDENTIFICATION_VALUE; /** * Thread pool run state service. - * - * @author chen.ma - * @date 2021/7/12 21:25 */ @Slf4j @AllArgsConstructor diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolStatusHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolStatusHandler.java index 62eb34d9..9f25413a 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolStatusHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/state/ThreadPoolStatusHandler.java @@ -27,9 +27,6 @@ import java.util.concurrent.atomic.AtomicInteger; /** * ThreadPool status handler. - * - * @author chen.ma - * @date 2022/1/18 20:54 */ @Slf4j public class ThreadPoolStatusHandler { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractBuildThreadPoolTemplate.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractBuildThreadPoolTemplate.java index 58e9b3a5..241179ac 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractBuildThreadPoolTemplate.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractBuildThreadPoolTemplate.java @@ -25,22 +25,15 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.core.task.TaskDecorator; import java.util.concurrent.*; -import java.util.concurrent.locks.AbstractQueuedSynchronizer; /** * Abstract build threadPool template. - * - * @author chen.ma - * @date 2021/7/5 21:45 */ @Slf4j public class AbstractBuildThreadPoolTemplate { /** - * 线程池构建初始化参数. - *

- * 此处本身是模版设计方法, 但是考虑创建简洁性, 移除 abstract. - * 异常参考 {@link AbstractQueuedSynchronizer#tryAcquire} + * Thread pool construction initialization parameters. * * @return */ @@ -48,11 +41,6 @@ public class AbstractBuildThreadPoolTemplate { throw new UnsupportedOperationException(); } - /** - * 构建线程池. - * - * @return - */ public static ThreadPoolExecutor buildPool() { ThreadPoolInitParam initParam = initParam(); return buildPool(initParam); diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractDynamicExecutorSupport.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractDynamicExecutorSupport.java index 088ceaf7..cff8087c 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractDynamicExecutorSupport.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/AbstractDynamicExecutorSupport.java @@ -25,9 +25,6 @@ import java.util.concurrent.*; /** * Dynamic executor configuration support. - * - * @author chen.ma - * @date 2021/11/28 12:17 */ @Slf4j public abstract class AbstractDynamicExecutorSupport extends ThreadPoolExecutor implements InitializingBean, DisposableBean { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/CommonDynamicThreadPool.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/CommonDynamicThreadPool.java index 2d0ee846..186dd47c 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/CommonDynamicThreadPool.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/CommonDynamicThreadPool.java @@ -22,21 +22,18 @@ import cn.hippo4j.core.executor.DynamicThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** - * Common dynamic threadPool. - * - * @author chen.ma - * @date 2021/6/16 22:35 + * Common dynamic thread-pool. */ public class CommonDynamicThreadPool { public static DynamicThreadPoolExecutor getInstance(String threadPoolId) { - DynamicThreadPoolExecutor poolExecutor = (DynamicThreadPoolExecutor) ThreadPoolBuilder.builder() + DynamicThreadPoolExecutor dynamicThreadPoolExecutor = (DynamicThreadPoolExecutor) ThreadPoolBuilder.builder() .dynamicPool() .threadFactory(threadPoolId) .poolThreadSize(2, 4) .keepAliveTime(60L, TimeUnit.SECONDS) .workQueue(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE, 1024) .build(); - return poolExecutor; + return dynamicThreadPoolExecutor; } } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/FastThreadPoolExecutor.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/FastThreadPoolExecutor.java index 6f87b0a4..31835191 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/FastThreadPoolExecutor.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/FastThreadPoolExecutor.java @@ -26,10 +26,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /** - * Fast threadPool executor. - * - * @author chen.ma - * @date 2021/7/5 21:00 + * Fast thread-pool executor. */ @Slf4j public class FastThreadPoolExecutor extends ThreadPoolExecutorTemplate { @@ -76,5 +73,4 @@ public class FastThreadPoolExecutor extends ThreadPoolExecutorTemplate { throw t; } } - } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java index 1985a9be..f605d6ea 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java @@ -29,9 +29,6 @@ import java.util.stream.Stream; /** * Queue type enum. - * - * @author chen.ma - * @date 2021/6/25 12:30 */ public enum QueueTypeEnum { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedPolicies.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedPolicies.java index ae8e01d9..931d06da 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedPolicies.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedPolicies.java @@ -25,9 +25,6 @@ import java.util.concurrent.ThreadPoolExecutor; /** * Rejected policies. - * - * @author chen.ma - * @date 2021/7/5 21:23 */ @Slf4j public class RejectedPolicies { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedTypeEnum.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedTypeEnum.java index 57517ab2..ac8e8e43 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedTypeEnum.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/RejectedTypeEnum.java @@ -29,9 +29,6 @@ import java.util.stream.Stream; /** * Reject policy type Enum. - * - * @author chen.ma - * @date 2021/7/10 23:16 */ public enum RejectedTypeEnum { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java index 8040f93f..77fccccb 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java @@ -24,10 +24,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.atomic.AtomicInteger; /** - * Resizable capacity linked-blocking-queue. - * - * @author chen.ma - * @date 2021/6/20 14:24 + * Resizable capacity linked-blocking-queue. Options Rabbitmq VariableLinkedBlockingQueue */ @Slf4j public class ResizableCapacityLinkedBlockingQueue extends LinkedBlockingQueue { @@ -38,9 +35,6 @@ public class ResizableCapacityLinkedBlockingQueue extends LinkedBlockingQueue public synchronized boolean setCapacity(Integer capacity) { boolean successFlag = true; - /** - * TODO:后续考虑切换 Rabbitmq VariableLinkedBlockingQueue - */ try { int oldCapacity = (int) ReflectUtil.getFieldValue(this, "capacity"); AtomicInteger count = (AtomicInteger) ReflectUtil.getFieldValue(this, "count"); @@ -54,7 +48,6 @@ public class ResizableCapacityLinkedBlockingQueue extends LinkedBlockingQueue log.error("Dynamic modification of blocking queue size failed.", ex); successFlag = false; } - return successFlag; } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java index fb43108e..479387c4 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java @@ -23,9 +23,6 @@ import java.util.concurrent.TimeUnit; /** * Task queue. - * - * @author chen.ma - * @date 2021/7/5 21:00 */ public class TaskQueue extends LinkedBlockingQueue { @@ -44,17 +41,18 @@ public class TaskQueue extends LinkedBlockingQueue @Override public boolean offer(Runnable runnable) { int currentPoolThreadSize = executor.getPoolSize(); - // 如果有核心线程正在空闲, 将任务加入阻塞队列, 由核心线程进行处理任务 + // If a core thread is idle, add the task to the blocking queue, and the core thread will process the task. if (executor.getSubmittedTaskCount() < currentPoolThreadSize) { return super.offer(runnable); } - // 当前线程池线程数量小于最大线程数, 返回false, 根据线程池源码, 会创建非核心线程 + // The current number of threads in the thread pool is less than the maximum number of threads, and returns false. + // According to the thread pool source code, non-core threads will be created. if (currentPoolThreadSize < executor.getMaximumPoolSize()) { return false; } - // 如果当前线程池数量大于最大线程数, 任务加入阻塞队列 + // If the current thread pool number is greater than the maximum number of threads, the task is added to the blocking queue. return super.offer(runnable); } @@ -64,5 +62,4 @@ public class TaskQueue extends LinkedBlockingQueue } return super.offer(o, timeout, unit); } - } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadFactoryBuilder.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadFactoryBuilder.java index 9ae828bc..6e56dc07 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadFactoryBuilder.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadFactoryBuilder.java @@ -25,9 +25,6 @@ import java.util.concurrent.atomic.AtomicLong; /** * Thread-factory builder. - * - * @author chen.ma - * @date 2021/7/5 21:53 */ public class ThreadFactoryBuilder implements Builder { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolBuilder.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolBuilder.java index 96521c24..ce51e17f 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolBuilder.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolBuilder.java @@ -27,9 +27,6 @@ import java.util.concurrent.*; /** * Thread-pool builder. - * - * @author chen.ma - * @date 2021/6/28 17:29 */ public class ThreadPoolBuilder implements Builder { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolExecutorTemplate.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolExecutorTemplate.java index 7e41ea0e..c60ecc4d 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolExecutorTemplate.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ThreadPoolExecutorTemplate.java @@ -23,9 +23,6 @@ import java.util.concurrent.*; /** * ThreadPool executor template. - * - * @author chen.ma - * @date 2021/7/5 21:59 */ public class ThreadPoolExecutorTemplate extends ThreadPoolExecutor { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/handler/DynamicThreadPoolBannerHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/handler/DynamicThreadPoolBannerHandler.java index 128b9b82..9e524637 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/handler/DynamicThreadPoolBannerHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/handler/DynamicThreadPoolBannerHandler.java @@ -18,7 +18,6 @@ package cn.hippo4j.core.handler; import cn.hippo4j.core.config.BootstrapPropertiesInterface; -import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; @@ -28,9 +27,6 @@ import org.springframework.boot.ansi.AnsiStyle; /** * Dynamic thread-pool print banner. - * - * @author chen.ma - * @date 2021/6/20 16:34 */ @Slf4j @RequiredArgsConstructor diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java index 101cd427..7871e1b5 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyInvocationHandler.java @@ -28,9 +28,6 @@ import java.util.concurrent.atomic.AtomicLong; /** * Rejected proxy invocation handler. - * - * @author chen.ma - * @date 2022/2/17 19:45 */ @AllArgsConstructor public class RejectedProxyInvocationHandler implements InvocationHandler { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyUtil.java b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyUtil.java index c5acc952..432ddbad 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyUtil.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/proxy/RejectedProxyUtil.java @@ -23,9 +23,6 @@ import java.util.concurrent.atomic.AtomicLong; /** * Rejected proxy util. - * - * @author chen.ma - * @date 2022/2/22 21:56 */ public class RejectedProxyUtil { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomBlockingQueue.java b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomBlockingQueue.java index 1e269ed3..893ee11f 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomBlockingQueue.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomBlockingQueue.java @@ -21,9 +21,6 @@ import java.util.concurrent.BlockingQueue; /** * Custom blocking-queue. - * - * @author chen.ma - * @date 2021/7/11 00:51 */ public interface CustomBlockingQueue { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomRejectedExecutionHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomRejectedExecutionHandler.java index fa5a0a40..8cdb7f8b 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomRejectedExecutionHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/CustomRejectedExecutionHandler.java @@ -21,9 +21,6 @@ import java.util.concurrent.RejectedExecutionHandler; /** * Custom rejected execution handler. - * - * @author chen.ma - * @date 2021/7/10 23:51 */ public interface CustomRejectedExecutionHandler { @@ -35,7 +32,7 @@ public interface CustomRejectedExecutionHandler { Integer getType(); /** - * Adapt hippo4j core rejected execution handler. + * Adapt hippo-4j core rejected execution handler. * * @return */ diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/DynamicThreadPoolServiceLoader.java b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/DynamicThreadPoolServiceLoader.java index 0ea8d7ca..e0a817bb 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/DynamicThreadPoolServiceLoader.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/DynamicThreadPoolServiceLoader.java @@ -23,9 +23,6 @@ import java.util.stream.Collectors; /** * Dynamic thread-pool service loader. - * - * @author chen.ma - * @date 2021/7/10 23:45 */ public class DynamicThreadPoolServiceLoader { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/ServiceLoaderInstantiationException.java b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/ServiceLoaderInstantiationException.java index 41d491b2..c5806119 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/spi/ServiceLoaderInstantiationException.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/spi/ServiceLoaderInstantiationException.java @@ -19,9 +19,6 @@ package cn.hippo4j.core.spi; /** * Service loader instantiation exception. - * - * @author chen.ma - * @date 2021/7/10 23:48 */ public class ServiceLoaderInstantiationException extends RuntimeException { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java index 9fe2b7fd..fec00c8d 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/IdentifyUtil.java @@ -18,12 +18,12 @@ package cn.hippo4j.core.toolkit; import cn.hippo4j.common.config.ApplicationContextHolder; +import cn.hippo4j.common.toolkit.ThreadUtil; import cn.hippo4j.core.toolkit.inet.InetUtils; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.google.common.base.Joiner; import com.google.common.collect.Lists; -import lombok.SneakyThrows; import org.springframework.core.env.ConfigurableEnvironment; import java.util.ArrayList; @@ -33,9 +33,6 @@ import static cn.hippo4j.common.constant.Constants.IDENTIFY_SLICER_SYMBOL; /** * Identify util. - * - * @author chen.ma - * @date 2021/12/5 22:25 */ public class IdentifyUtil { @@ -70,7 +67,6 @@ public class IdentifyUtil { * * @return */ - @SneakyThrows public static String getIdentify() { while (StrUtil.isBlank(IDENTIFY)) { ConfigurableEnvironment environment = ApplicationContextHolder.getBean(ConfigurableEnvironment.class); @@ -79,7 +75,7 @@ public class IdentifyUtil { String identify = generate(environment, inetUtils); return identify; } - Thread.sleep(500); + ThreadUtil.sleep(500); } return IDENTIFY; } @@ -93,8 +89,7 @@ public class IdentifyUtil { * @return */ public static String getThreadPoolIdentify(String threadPoolId, String itemId, String namespace) { - ArrayList params = Lists.newArrayList( - threadPoolId, itemId, namespace, getIdentify()); + ArrayList params = Lists.newArrayList(threadPoolId, itemId, namespace, getIdentify()); return Joiner.on(GROUP_KEY_DELIMITER).join(params); } } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/SystemClock.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/SystemClock.java index e0845133..473148b3 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/SystemClock.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/SystemClock.java @@ -22,9 +22,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; /** - * @author : wh - * @date : 2022/4/25 17:03 - * @description: + * System clock. */ public class SystemClock { @@ -50,8 +48,8 @@ public class SystemClock { } private void scheduleClockUpdating() { - ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1, r -> { - Thread thread = new Thread(r, THREAD_NAME); + ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1, runnable -> { + Thread thread = new Thread(runnable, THREAD_NAME); thread.setDaemon(true); return thread; }); diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/TraceContextUtil.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/TraceContextUtil.java index f75ce753..e87ce031 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/TraceContextUtil.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/TraceContextUtil.java @@ -23,9 +23,6 @@ import static cn.hippo4j.common.constant.Constants.EXECUTE_TIMEOUT_TRACE; /** * Trace context util. - * - * @author chen.ma - * @date 2022/3/3 08:30 */ public class TraceContextUtil { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/DynamicThreadPoolAnnotationUtil.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/DynamicThreadPoolAnnotationUtil.java index 5bdf0f58..d11b2fd3 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/DynamicThreadPoolAnnotationUtil.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/DynamicThreadPoolAnnotationUtil.java @@ -57,8 +57,6 @@ public class DynamicThreadPoolAnnotationUtil { .map(definition -> definition.getResolvedFactoryMethod()) .map(factoryMethod -> AnnotationUtils.getAnnotation(factoryMethod, annotationType)) .orElse(null); - return annotation; } - } diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java index 7dbd4eb2..cc7e5c68 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtils.java @@ -36,9 +36,6 @@ import java.util.concurrent.TimeUnit; /** * Inet utils. - * - * @author Spencer Gibb - * @date 2021/11/12 21:33 */ public class InetUtils implements Closeable { @@ -86,7 +83,6 @@ public class InetUtils implements Closeable { } else if (result != null) { continue; } - // @formatter:off if (!ignoreInterface(ifc.getDisplayName())) { for (Enumeration addrs = ifc @@ -107,22 +103,18 @@ public class InetUtils implements Closeable { } catch (IOException ex) { this.log.error("Cannot get first non-loopback address", ex); } - if (result != null) { return result; } - try { return InetAddress.getLocalHost(); } catch (UnknownHostException e) { this.log.warn("Unable to retrieve localhost"); } - return null; } boolean isPreferredAddress(InetAddress address) { - if (this.properties.isUseOnlySiteLocalInterfaces()) { final boolean siteLocalAddress = address.isSiteLocalAddress(); if (!siteLocalAddress) { diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtilsProperties.java b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtilsProperties.java index c5fb7908..446a6024 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtilsProperties.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/toolkit/inet/InetUtilsProperties.java @@ -26,9 +26,6 @@ import java.util.List; /** * Inet utils properties. - * - * @author chen.ma - * @date 2021/11/12 21:34 */ @ConfigurationProperties(InetUtilsProperties.PREFIX) public class InetUtilsProperties {