From 3e9ce56b5133596211a7bdd50d82fc41ca03f565 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Sat, 21 Aug 2021 23:38:49 +0800 Subject: [PATCH] Optimize the comments and logs of the dynamic common module. --- .../config/ApplicationContextHolder.java | 8 ++--- .../threadpool/common/constant/Constants.java | 2 +- .../common/executor/ExecutorFactory.java | 3 +- .../common/executor/ThreadPoolManager.java | 1 + .../common/model/GlobalRemotePoolInfo.java | 28 ++++++++-------- .../threadpool/common/model/InstanceInfo.java | 2 +- .../common/model/PoolParameter.java | 2 +- .../common/model/PoolParameterInfo.java | 28 ++++++++-------- .../common/model/PoolRunStateInfo.java | 32 +++++++++---------- .../threadpool/common/toolkit/Assert.java | 2 +- .../common/toolkit/ContentUtil.java | 3 +- .../threadpool/common/toolkit/GroupKey.java | 2 +- .../threadpool/common/toolkit/Md5Util.java | 2 +- .../threadpool/common/web/base/Result.java | 2 +- .../threadpool/common/web/base/Results.java | 2 +- .../common/web/exception/ErrorCodeEnum.java | 10 +++--- .../web/exception/ServiceException.java | 2 +- 17 files changed, 67 insertions(+), 64 deletions(-) diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java index 9bc2f425..145e32ab 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/config/ApplicationContextHolder.java @@ -7,7 +7,7 @@ import org.springframework.context.ApplicationContextAware; import java.util.Map; /** - * 非 Spring 环境下获取 IOC 容器对象 + * Application context holder. * * @author chen.ma * @date 2021/6/20 18:49 @@ -22,7 +22,7 @@ public class ApplicationContextHolder implements ApplicationContextAware { } /** - * 根据类型获取 IOC 容器 Bean + * Get ioc container bean by type. * * @param clazz * @param @@ -33,7 +33,7 @@ public class ApplicationContextHolder implements ApplicationContextAware { } /** - * 根据名称 & 类型获取 IOC 容器 Bean + * Get ioc container bean by name and type. * * @param name * @param clazz @@ -45,7 +45,7 @@ public class ApplicationContextHolder implements ApplicationContextAware { } /** - * 根据类型获取一组 IOC 容器 Bean + * Get a set of ioc container beans by type. * * @param clazz * @param diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/constant/Constants.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/constant/Constants.java index de20fa20..f05e3ce9 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/constant/Constants.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/constant/Constants.java @@ -1,7 +1,7 @@ package com.github.dynamic.threadpool.common.constant; /** - * Constants + * Constants. * * @author chen.ma * @date 2021/6/16 23:01 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ExecutorFactory.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ExecutorFactory.java index ee39b065..7f5ef744 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ExecutorFactory.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ExecutorFactory.java @@ -5,7 +5,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; /** - * Executor Factory. + * Executor factory. * * @author chen.ma * @date 2021/6/23 18:35 @@ -24,4 +24,5 @@ public class ExecutorFactory { return executorService; } } + } diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ThreadPoolManager.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ThreadPoolManager.java index 56476d9a..d2262a39 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ThreadPoolManager.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/executor/ThreadPoolManager.java @@ -59,4 +59,5 @@ public class ThreadPoolManager { map.get(group).add(executor); } } + } diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/GlobalRemotePoolInfo.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/GlobalRemotePoolInfo.java index e76106e5..ef20d99a 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/GlobalRemotePoolInfo.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/GlobalRemotePoolInfo.java @@ -6,7 +6,7 @@ import lombok.Setter; import java.io.Serializable; /** - * 远程调用通用参数 + * Global remote pool info. * * @author chen.ma * @date 2021/6/23 21:08 @@ -18,67 +18,67 @@ public class GlobalRemotePoolInfo implements Serializable { private static final long serialVersionUID = 5447003335557127308L; /** - * 命名空间 + * tenantId */ private String tenantId; /** - * 项目 ID + * itemId */ private String itemId; /** - * 线程池标识 + * tpId */ private String tpId; /** - * 核心线程数 + * coreSize */ private Integer coreSize; /** - * 最大线程数 + * maxSize */ private Integer maxSize; /** - * 队列类型 + * queueType */ private Integer queueType; /** - * 队列长度 + * capacity */ private Integer capacity; /** - * 线程存活时长 + * keepAliveTime */ private Integer keepAliveTime; /** - * 是否告警 + * isAlarm */ private Integer isAlarm; /** - * 容量告警 + * capacityAlarm */ private Integer capacityAlarm; /** - * 活跃度告警 + * livenessAlarm */ private Integer livenessAlarm; /** - * MD5 + * md5 */ private String md5; /** - * 内容 + * content */ private String content; diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/InstanceInfo.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/InstanceInfo.java index 58cb942d..714e51bd 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/InstanceInfo.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/InstanceInfo.java @@ -7,7 +7,7 @@ import lombok.experimental.Accessors; import lombok.extern.slf4j.Slf4j; /** - * Instance Info. + * Instance info. * * @author chen.ma * @date 2021/7/13 22:10 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameter.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameter.java index 88fbe181..e46e4504 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameter.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameter.java @@ -1,7 +1,7 @@ package com.github.dynamic.threadpool.common.model; /** - * Pool Parameter. + * Pool parameter. * * @author chen.ma * @date 2021/6/24 16:04 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameterInfo.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameterInfo.java index 6a47563d..18e5a354 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameterInfo.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolParameterInfo.java @@ -6,7 +6,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; /** - * 线程池参数 + * Thread pool parameter info. * * @author chen.ma * @date 2021/6/16 23:18 @@ -18,67 +18,67 @@ public class PoolParameterInfo implements PoolParameter, Serializable { private static final long serialVersionUID = -7123935122108553864L; /** - * 命名空间 + * tenantId */ private String tenantId; /** - * 项目 Id + * itemId */ private String itemId; /** - * 线程池 Id + * tpId */ private String tpId; /** - * 内容 + * content */ private String content; /** - * 核心线程数 + * coreSize */ private Integer coreSize; /** - * 最大线程数 + * maxSize */ private Integer maxSize; /** - * 队列类型 + * queueType */ private Integer queueType; /** - * 队列长度 + * capacity */ private Integer capacity; /** - * 线程存活时长 + * keepAliveTime */ private Integer keepAliveTime; /** - * 拒绝策略类型 + * rejectedType */ private Integer rejectedType; /** - * 是否告警 + * isAlarm */ private Integer isAlarm; /** - * 容量告警 + * capacityAlarm */ private Integer capacityAlarm; /** - * 活跃度告警 + * livenessAlarm */ private Integer livenessAlarm; diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java index c086ac90..f2915c93 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java @@ -6,7 +6,7 @@ import lombok.Setter; import java.io.Serializable; /** - * Pool Run State Info. + * Pool run state info. * * @author chen.ma * @date 2021/7/7 18:57 @@ -16,77 +16,77 @@ import java.io.Serializable; public class PoolRunStateInfo implements Serializable { /** - * 当前负载 + * currentLoad */ private String currentLoad; /** - * 峰值负载 + * peakLoad */ private String peakLoad; /** - * 线程池 ID + * tpId */ private String tpId; /** - * 核心线程数 + * coreSize */ private Integer coreSize; /** - * 最大线程数 + * maximumSize */ private Integer maximumSize; /** - * 线程池当前线程数 + * poolSize */ private Integer poolSize; /** - * 活跃线程数 + * activeSize */ private Integer activeSize; /** - * 线程池中同时进入的最大线程数 + * The maximum number of threads that enter the thread pool at the same time */ private Integer largestPoolSize; /** - * 队列类型 + * queueType */ private String queueType; /** - * 队列容量 + * queueCapacity */ private Integer queueCapacity; /** - * 队列元素个数 + * queueSize */ private Integer queueSize; /** - * 队列剩余容量 + * queueRemainingCapacity */ private Integer queueRemainingCapacity; /** - * 线程池中执行任务总数量 + * completedTaskCount */ private Long completedTaskCount; /** - * 拒绝策略发生次数 + * rejectCount */ private Integer rejectCount; /** - * Host + * host */ private String host; diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Assert.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Assert.java index c69658d7..8bd43dd1 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Assert.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Assert.java @@ -7,7 +7,7 @@ import java.util.Collection; import java.util.Map; /** - * 断言工具类 + * Assert. * * @author chen.ma * @date 2021/6/29 09:36 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/ContentUtil.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/ContentUtil.java index 8ddc16c6..2ad70a79 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/ContentUtil.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/ContentUtil.java @@ -6,7 +6,7 @@ import com.github.dynamic.threadpool.common.model.PoolParameter; import com.github.dynamic.threadpool.common.model.PoolParameterInfo; /** - * Content Util. + * Content util. * * @author chen.ma * @date 2021/6/24 16:13 @@ -40,4 +40,5 @@ public class ContentUtil { .toString(); return resultStr; } + } diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/GroupKey.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/GroupKey.java index ce20f97a..53f21d47 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/GroupKey.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/GroupKey.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.common.toolkit; import org.springframework.util.StringUtils; /** - * Group Key + * Group key. * * @author chen.ma * @date 2021/6/24 21:12 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Md5Util.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Md5Util.java index 4e253129..a3563751 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Md5Util.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/toolkit/Md5Util.java @@ -13,7 +13,7 @@ import java.util.List; import static com.github.dynamic.threadpool.common.constant.Constants.WORD_SEPARATOR; /** - * MD5 Util. + * MD5 util. * * @author chen.ma * @date 2021/6/22 17:55 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Result.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Result.java index e7535b4d..ae2d22f5 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Result.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Result.java @@ -6,7 +6,7 @@ import lombok.experimental.Accessors; import java.io.Serializable; /** - * 全局返回对象 + * Result. * * @author chen.ma * @date 2021/3/19 16:12 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Results.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Results.java index 5d015759..8191cb5f 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Results.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/base/Results.java @@ -4,7 +4,7 @@ import com.github.dynamic.threadpool.common.web.exception.ErrorCodeEnum; import com.github.dynamic.threadpool.common.web.exception.ServiceException; /** - * Result 工具类 + * Results. * * @author chen.ma * @date 2021/3/19 16:12 diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ErrorCodeEnum.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ErrorCodeEnum.java index 23b713b5..51f4bcfa 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ErrorCodeEnum.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ErrorCodeEnum.java @@ -1,7 +1,7 @@ package com.github.dynamic.threadpool.common.web.exception; /** - * 异常码 + * Error code enum. * * @author chen.ma * @date 2021/3/19 16:07 @@ -16,7 +16,7 @@ public enum ErrorCodeEnum { @Override public String getMessage() { - return "未知错误"; + return "UNKNOWN_ERROR"; } }, @@ -28,7 +28,7 @@ public enum ErrorCodeEnum { @Override public String getMessage() { - return "参数错误"; + return "VALIDATION_ERROR"; } }, @@ -40,7 +40,7 @@ public enum ErrorCodeEnum { @Override public String getMessage() { - return "服务异常"; + return "SERVICE_ERROR"; } }, @@ -52,7 +52,7 @@ public enum ErrorCodeEnum { @Override public String getMessage() { - return "未找到异常"; + return "NOT_FOUND"; } }; diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ServiceException.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ServiceException.java index 153e6437..7d0e07dc 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ServiceException.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/web/exception/ServiceException.java @@ -4,7 +4,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; /** - * 业务系统业务逻辑相关异常 + * Service exception. * * @author chen.ma * @date 2021/3/19 16:14