diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/CommonConfig.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/CommonConfig.java index abeba311..734e67bf 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/CommonConfig.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/CommonConfig.java @@ -5,7 +5,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** - * 公共配置. + * Common config. * * @author chen.ma * @date 2021/7/19 21:03 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MyMetaObjectHandler.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MyMetaObjectHandler.java index ea45c9b5..c8772ae4 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MyMetaObjectHandler.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MyMetaObjectHandler.java @@ -9,7 +9,7 @@ import org.springframework.stereotype.Component; import java.util.Date; /** - * Meta Object Handler. + * Meta object handler. * * @author chen.ma * @date 2021/7/1 22:43 @@ -17,6 +17,7 @@ import java.util.Date; @Slf4j @Component public class MyMetaObjectHandler implements MetaObjectHandler { + @Override public void insertFill(MetaObject metaObject) { this.strictInsertFill(metaObject, "gmtCreate", Date.class, new Date()); @@ -29,4 +30,5 @@ public class MyMetaObjectHandler implements MetaObjectHandler { public void updateFill(MetaObject metaObject) { this.strictInsertFill(metaObject, "gmtModified", Date.class, new Date()); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MybatisPlusConfig.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MybatisPlusConfig.java index 96a76bc1..40cf4c85 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MybatisPlusConfig.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/config/MybatisPlusConfig.java @@ -7,7 +7,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; /** - * Mybatis Plus Config. + * Mybatis plus config. * * @author chen.ma * @date 2021/6/29 20:22 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/controller/ConfigController.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/controller/ConfigController.java index 8d111882..60f99ffd 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/controller/ConfigController.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/controller/ConfigController.java @@ -19,7 +19,7 @@ import java.net.URLDecoder; import java.util.Map; /** - * 服务端配置控制器 + * Server configuration controller. * * @author chen.ma * @date 2021/6/20 13:53 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/enums/DelEnum.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/enums/DelEnum.java index b631481d..77dee8ae 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/enums/DelEnum.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/enums/DelEnum.java @@ -9,12 +9,12 @@ package com.github.dynamic.threadpool.config.enums; public enum DelEnum { /** - * 正常状态 + * Normal state */ NORMAL("0"), /** - * 删除状态 + * Deleted state */ DELETE("1"); diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/ConfigDataChangeEvent.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/ConfigDataChangeEvent.java index 2ee142a7..8e1af218 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/ConfigDataChangeEvent.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/ConfigDataChangeEvent.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.event; import org.springframework.util.StringUtils; /** - * Config Data Change Event. + * Config data change event. * * @author chen.ma * @date 2021/6/24 23:35 @@ -20,7 +20,7 @@ public class ConfigDataChangeEvent extends Event { public ConfigDataChangeEvent(String tenantId, String itemId, String tpId, Long gmtModified) { if (StringUtils.isEmpty(tenantId) || StringUtils.isEmpty(itemId) || StringUtils.isEmpty(tpId)) { - throw new IllegalArgumentException("dataId is null or group is null"); + throw new IllegalArgumentException("DataId is null or group is null"); } this.tenantId = tenantId; @@ -28,4 +28,5 @@ public class ConfigDataChangeEvent extends Event { this.tpId = tpId; this.lastModifiedTs = gmtModified; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/Event.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/Event.java index 162803a3..82a1c72a 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/Event.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/Event.java @@ -23,4 +23,5 @@ public abstract class Event implements Serializable { public long sequence() { return sequence; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/LocalDataChangeEvent.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/LocalDataChangeEvent.java index 28a1abd8..de778a02 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/LocalDataChangeEvent.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/LocalDataChangeEvent.java @@ -1,7 +1,7 @@ package com.github.dynamic.threadpool.config.event; /** - * Local Data Change Event. + * Local data change event. * * @author chen.ma * @date 2021/6/23 19:13 @@ -13,4 +13,5 @@ public class LocalDataChangeEvent extends Event { public LocalDataChangeEvent(String groupKey) { this.groupKey = groupKey; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/SlowEvent.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/SlowEvent.java index e6b445ad..127e9c9f 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/SlowEvent.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/event/SlowEvent.java @@ -1,7 +1,7 @@ package com.github.dynamic.threadpool.config.event; /** - * Slow Event. + * Slow event. * * @author chen.ma * @date 2021/6/23 19:05 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ConfigInfoMapper.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ConfigInfoMapper.java index 47babada..ea33e779 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ConfigInfoMapper.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ConfigInfoMapper.java @@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.config.model.ConfigAllInfo; import org.apache.ibatis.annotations.Mapper; /** - * Config Info Mapper. + * Config info mapper. * * @author chen.ma * @date 2021/6/29 22:44 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ItemInfoMapper.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ItemInfoMapper.java index 0a592f77..4aa0af90 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ItemInfoMapper.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/ItemInfoMapper.java @@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.config.model.ItemInfo; import org.apache.ibatis.annotations.Mapper; /** - * Item Info Mapper. + * Item info mapper. * * @author chen.ma * @date 2021/6/29 21:53 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/TenantInfoMapper.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/TenantInfoMapper.java index 97123a31..e84006f4 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/TenantInfoMapper.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/mapper/TenantInfoMapper.java @@ -5,7 +5,7 @@ import com.github.dynamic.threadpool.config.model.TenantInfo; import org.apache.ibatis.annotations.Mapper; /** - * Tenant Info Mapper. + * Tenant info mapper. * * @author chen.ma * @date 2021/6/29 22:44 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/CacheItem.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/CacheItem.java index 8f97e435..228ce739 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/CacheItem.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/CacheItem.java @@ -7,7 +7,7 @@ import lombok.Getter; import lombok.Setter; /** - * Cache Item. + * Cache item. * * @author chen.ma * @date 2021/6/24 21:23 @@ -32,4 +32,5 @@ public class CacheItem { this.md5 = md5; this.groupKey = SingletonRepository.DataIdGroupIdCache.getSingleton(groupKey); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigAllInfo.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigAllInfo.java index 7b11e589..4859de98 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigAllInfo.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigAllInfo.java @@ -11,7 +11,7 @@ import lombok.Data; import java.util.Date; /** - * 配置全部信息 + * Config all info. * * @author chen.ma * @date 2021/6/20 15:14 @@ -23,28 +23,28 @@ public class ConfigAllInfo extends ConfigInfo implements PoolParameter { private static final long serialVersionUID = -2417394244017463665L; /** - * 简介 + * desc */ @JSONField(serialize = false) @TableField(exist = false, fill = FieldFill.UPDATE) private String desc; /** - * 创建时间 + * gmtCreate */ @JSONField(serialize = false) @TableField(fill = FieldFill.INSERT) private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @JSONField(serialize = false) @TableField(fill = FieldFill.INSERT_UPDATE) private Date gmtModified; /** - * 是否删除 + * delFlag */ @TableLogic @JSONField(serialize = false) diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfo.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfo.java index 7fa98d4a..6a70b23d 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfo.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfo.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model; import lombok.Data; /** - * 配置信息 + * Config info. * * @author chen.ma * @date 2021/6/20 15:59 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfoBase.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfoBase.java index 376b080b..67015c1e 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfoBase.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ConfigInfoBase.java @@ -8,7 +8,7 @@ import lombok.Data; import java.io.Serializable; /** - * 基础配置信息 + * Config info base. * * @author chen.ma * @date 2021/6/20 14:05 @@ -40,47 +40,47 @@ public class ConfigInfoBase implements Serializable { private String itemId; /** - * 核心线程数 + * 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; @@ -91,8 +91,9 @@ public class ConfigInfoBase implements Serializable { private String md5; /** - * 内容 + * content */ @JSONField(serialize = false) private String content; + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ItemInfo.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ItemInfo.java index a326d25b..a3eba8b1 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ItemInfo.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/ItemInfo.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * Item Info. + * Item info. * * @author chen.ma * @date 2021/6/29 21:53 @@ -22,44 +22,44 @@ public class ItemInfo { private Integer id; /** - * 租户ID + * tenantId */ private String tenantId; /** - * 项目ID + * itemId */ private String itemId; /** - * 项目名称 + * itemName */ private String itemName; /** - * 项目简介 + * itemDesc */ private String itemDesc; /** - * 负责人 + * owner */ private String owner; /** - * 创建时间 + * gmtCreate */ @TableField(fill = FieldFill.INSERT) private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @TableField(fill = FieldFill.INSERT_UPDATE) private Date gmtModified; /** - * 是否删除 + * delFlag */ @TableLogic @TableField(fill = FieldFill.INSERT) diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/TenantInfo.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/TenantInfo.java index 3c585b4a..348da685 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/TenantInfo.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/TenantInfo.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * 业务线实体信息 + * Tenant info. * * @author chen.ma * @date 2021/6/29 22:04 @@ -22,39 +22,39 @@ public class TenantInfo { private Integer id; /** - * 租户ID + * tenantId */ private String tenantId; /** - * 租户名称 + * tenantName */ private String tenantName; /** - * 租户简介 + * tenantDesc */ private String tenantDesc; /** - * 负责人 + * owner */ private String owner; /** - * 创建时间 + * gmtCreate */ @TableField(fill = FieldFill.INSERT) private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @TableField(fill = FieldFill.INSERT_UPDATE) private Date gmtModified; /** - * 是否删除 + * delFlag */ @TableField(fill = FieldFill.INSERT) private Integer delFlag; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemQueryReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemQueryReqDTO.java index b701753d..0f27e6e8 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemQueryReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemQueryReqDTO.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.Data; /** - * Item Query Req DTO. + * Item query req dto. * * @author chen.ma * @date 2021/6/29 22:28 @@ -12,11 +12,24 @@ import lombok.Data; @Data public class ItemQueryReqDTO extends Page { + /** + * tenantId + */ private String tenantId; + /** + * itemId + */ private String itemId; + /** + * itemName + */ private String itemName; + /** + * owner + */ private String owner; + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemRespDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemRespDTO.java index 9f941569..07b03701 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemRespDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemRespDTO.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * 项目出参 + * Item resp dto. * * @author chen.ma * @date 2021/6/29 21:15 @@ -20,38 +20,38 @@ public class ItemRespDTO { private Integer id; /** - * 租户 ID + * tenantId */ private String tenantId; /** - * 项目 ID + * itemId */ private String itemId; /** - * 项目名称 + * itemName */ private String itemName; /** - * 项目介绍 + * itemDesc */ private String itemDesc; /** - * 项目负责人 + * owner */ private String owner; /** - * 创建时间 + * gmtCreate */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtModified; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemSaveReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemSaveReqDTO.java index 33faa463..14d30956 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemSaveReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemSaveReqDTO.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model.biz.item; import lombok.Data; /** - * Item Save Req DTO. + * Item save req dto. * * @author chen.ma * @date 2021/6/29 22:05 @@ -12,27 +12,27 @@ import lombok.Data; public class ItemSaveReqDTO { /** - * 租户 ID + * tenantId */ private String tenantId; /** - * 项目 ID + * itemId */ private String itemId; /** - * 项目名称 + * itemName */ private String itemName; /** - * 项目介绍 + * itemDesc */ private String itemDesc; /** - * 项目负责人 + * owner */ private String owner; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemUpdateReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemUpdateReqDTO.java index 9f50f3b9..8d422d68 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemUpdateReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/item/ItemUpdateReqDTO.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model.biz.item; import lombok.Data; /** - * Item Update Req DTO. + * Item update req dto. * * @author chen.ma * @date 2021/6/29 22:05 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantQueryReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantQueryReqDTO.java index 90dbf337..84afe27e 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantQueryReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantQueryReqDTO.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.Data; /** - * Tenant Query Req DTO. + * Tenant query req dto. * * @author chen.ma * @date 2021/6/29 22:28 @@ -12,9 +12,19 @@ import lombok.Data; @Data public class TenantQueryReqDTO extends Page { + /** + * tenantId + */ private String tenantId; + /** + * tenantName + */ private String tenantName; + /** + * owner + */ private String owner; + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantRespDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantRespDTO.java index f968310d..23c78125 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantRespDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantRespDTO.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * 业务线出参 + * Tenant resp dto. * * @author chen.ma * @date 2021/6/29 21:16 @@ -20,33 +20,33 @@ public class TenantRespDTO { private Integer id; /** - * 租户ID + * tenantId */ private String tenantId; /** - * 租户名称 + * tenantName */ private String tenantName; /** - * 租户简介 + * tenantDesc */ private String tenantDesc; /** - * 负责人 + * owner */ private String owner; /** - * 创建时间 + * gmtCreate */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtModified; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantSaveReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantSaveReqDTO.java index e15d841d..5d2bd7f3 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantSaveReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantSaveReqDTO.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model.biz.tenant; import lombok.Data; /** - * Tenant Save Req DTO. + * Tenant save req dto. * * @author chen.ma * @date 2021/6/29 20:40 @@ -12,22 +12,22 @@ import lombok.Data; public class TenantSaveReqDTO { /** - * 租户ID + * tenantId */ private String tenantId; /** - * 租户名称 + * tenantName */ private String tenantName; /** - * 租户简介 + * tenantDesc */ private String tenantDesc; /** - * 负责人 + * owner */ private String owner; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantUpdateReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantUpdateReqDTO.java index 6c5ce2ad..265b0108 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantUpdateReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/tenant/TenantUpdateReqDTO.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model.biz.tenant; import lombok.Data; /** - * Tenant Save Req DTO. + * Tenant save req dto. * * @author chen.ma * @date 2021/6/29 20:40 @@ -12,22 +12,22 @@ import lombok.Data; public class TenantUpdateReqDTO { /** - * 租户 ID + * tenantId */ private String tenantId; /** - * 租户名称 + * tenantName */ private String tenantName; /** - * 租户简介 + * tenantDesc */ private String tenantDesc; /** - * 负责人 + * owner */ private String owner; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolQueryReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolQueryReqDTO.java index 76f152fe..7be33ba8 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolQueryReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolQueryReqDTO.java @@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.Data; /** - * Thread Pool Query Req DTO. + * Thread pool query req dto. * * @author chen.ma * @date 2021/6/30 21:22 @@ -13,17 +13,17 @@ import lombok.Data; public class ThreadPoolQueryReqDTO extends Page { /** - * 租户 ID + * tenantId */ private String tenantId; /** - * 项目 ID + * itemId */ private String itemId; /** - * 线程池 ID + * tpId */ private String tpId; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolRespDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolRespDTO.java index 7a579de3..b9ab7edc 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolRespDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolRespDTO.java @@ -6,7 +6,7 @@ import lombok.Data; import java.util.Date; /** - * Thread Pool Resp DTO. + * Thread pool resp dto. * * @author chen.ma * @date 2021/6/30 21:23 @@ -15,73 +15,73 @@ import java.util.Date; public class ThreadPoolRespDTO { /** - * 命名空间 + * 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; /** - * 是否告警 + * isAlarm */ private Integer isAlarm; /** - * 容量告警 + * capacityAlarm */ private Integer capacityAlarm; /** - * 活跃度告警 + * livenessAlarm */ private Integer livenessAlarm; /** - * 创建时间 + * gmtCreate */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtCreate; /** - * 修改时间 + * gmtModified */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date gmtModified; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolSaveOrUpdateReqDTO.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolSaveOrUpdateReqDTO.java index 7747c856..b183938c 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolSaveOrUpdateReqDTO.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/model/biz/threadpool/ThreadPoolSaveOrUpdateReqDTO.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.model.biz.threadpool; import lombok.Data; /** - * Thread Pool Save Or Update Req DTO. + * Thread pool save or update req dto. * * @author chen.ma * @date 2021/6/30 21:23 @@ -27,42 +27,42 @@ public class ThreadPoolSaveOrUpdateReqDTO { private String itemId; /** - * 核心线程数 + * 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; diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultPublisher.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultPublisher.java index 946400b8..ec6f2b1b 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultPublisher.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultPublisher.java @@ -85,7 +85,7 @@ public class DefaultPublisher extends Thread implements EventPublisher { UPDATER.compareAndSet(this, lastEventSequence, Math.max(lastEventSequence, event.sequence())); } } catch (Throwable ex) { - log.error("Event listener exception : {}", ex); + log.error("Event listener exception :: {}", ex); } } @@ -98,7 +98,7 @@ public class DefaultPublisher extends Thread implements EventPublisher { public boolean publish(Event event) { boolean success = this.queue.offer(event); if (!success) { - log.warn("Unable to plug in due to interruption, synchronize sending time, event : {}", event); + log.warn("Unable to plug in due to interruption, synchronize sending time, event :: {}", event); receiveEvent(event); return true; } @@ -117,7 +117,7 @@ public class DefaultPublisher extends Thread implements EventPublisher { try { job.run(); } catch (Throwable e) { - log.error("Event callback exception : {}", e); + log.error("Event callback exception :: {}", e); } } } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultSharePublisher.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultSharePublisher.java index 081aa17e..f641852c 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultSharePublisher.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/DefaultSharePublisher.java @@ -12,7 +12,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** - * Default Share Publisher. + * Default share publisher. * * @author chen.ma * @date 2021/6/23 19:05 @@ -43,4 +43,5 @@ public class DefaultSharePublisher extends DefaultPublisher { lock.unlock(); } } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/EventPublisher.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/EventPublisher.java index 56215a60..91275ea1 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/EventPublisher.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/EventPublisher.java @@ -11,12 +11,35 @@ import com.github.dynamic.threadpool.config.event.Event; */ public interface EventPublisher { + /** + * Init. + * + * @param type + * @param bufferSize + */ void init(Class type, int bufferSize); + /** + * Add subscriber. + * + * @param subscriber + */ void addSubscriber(Subscriber subscriber); + /** + * Publish. + * + * @param event + * @return + */ boolean publish(Event event); + /** + * Notify subscriber. + * + * @param subscriber + * @param event + */ void notifySubscriber(Subscriber subscriber, Event event); } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/NotifyCenter.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/NotifyCenter.java index 620ff818..1072d99d 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/NotifyCenter.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/NotifyCenter.java @@ -13,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiFunction; /** - * Unified Event Notify Center. + * Unified event notify center. * * @author chen.ma * @date 2021/6/23 18:58 @@ -44,7 +44,7 @@ public class NotifyCenter { publisher.init(cls, buffer); return publisher; } catch (Throwable ex) { - log.error("Service class newInstance has error : {}", ex); + log.error("Service class newInstance has error :: {}", ex); throw new RuntimeException(ex); } }; @@ -87,7 +87,7 @@ public class NotifyCenter { try { return publishEvent(event.getClass(), event); } catch (Throwable ex) { - log.error("There was an exception to the message publishing : {}", ex); + log.error("There was an exception to the message publishing :: {}", ex); return false; } } @@ -118,4 +118,5 @@ public class NotifyCenter { } return INSTANCE.publisherMap.get(topic); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/SmartSubscriber.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/SmartSubscriber.java index 7d8d3ded..9d6483a9 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/SmartSubscriber.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/SmartSubscriber.java @@ -12,5 +12,11 @@ import java.util.List; */ public abstract class SmartSubscriber extends Subscriber { + /** + * Subscribe types. + * + * @return + */ public abstract List> subscribeTypes(); + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/Subscriber.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/Subscriber.java index 69183b2d..ccafd671 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/Subscriber.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/notify/listener/Subscriber.java @@ -29,4 +29,5 @@ public abstract class Subscriber { public Executor executor() { return null; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigCacheService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigCacheService.java index 09dfdc2e..ca17b838 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigCacheService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigCacheService.java @@ -14,7 +14,7 @@ import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; /** - * Config Cache Service. + * Config cache service. * * @author chen.ma * @date 2021/6/24 21:19 @@ -31,8 +31,8 @@ public class ConfigCacheService { } /** - * 获取 Md5 - * TODO:加入 IP, 不同 IP 的线程池区别改写 + * Get Md5. + * TODO:Add IP, different IP thread pool rewrite * TODO:groupKey && Md5 Cache * * @param groupKey @@ -92,4 +92,5 @@ public class ConfigCacheService { item = CACHE.putIfAbsent(groupKey, tmp); return (null == item) ? tmp : item; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigChangePublisher.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigChangePublisher.java index f2561a3a..0c52273f 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigChangePublisher.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigChangePublisher.java @@ -4,7 +4,7 @@ import com.github.dynamic.threadpool.config.event.LocalDataChangeEvent; import com.github.dynamic.threadpool.config.notify.NotifyCenter; /** - * Config Change Publisher. + * Config change publisher. * * @author chen.ma * @date 2021/6/24 23:34 @@ -12,7 +12,7 @@ import com.github.dynamic.threadpool.config.notify.NotifyCenter; public class ConfigChangePublisher { /** - * Notify ConfigChange. + * Notify configChange. * * @param event */ diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigServletInner.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigServletInner.java index d144acd6..f4748b2e 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigServletInner.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/ConfigServletInner.java @@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.Map; /** - * Config Servlet Inner. + * Config servlet inner. * * @author chen.ma * @date 2021/6/22 23:13 @@ -26,4 +26,5 @@ public class ConfigServletInner { } return HttpServletResponse.SC_OK + ""; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/LongPollingService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/LongPollingService.java index cd03395b..01eb5d58 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/LongPollingService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/LongPollingService.java @@ -24,7 +24,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; /** - * 长轮询服务 + * Long polling service. * * @author chen.ma * @date 2021/6/22 23:14 @@ -206,7 +206,6 @@ public class LongPollingService { } private void sendResponse(List changedGroups) { - // Cancel time out task. if (null != asyncTimeoutFuture) { asyncTimeoutFuture.cancel(false); @@ -245,12 +244,6 @@ public class LongPollingService { return retainIps; } - /** - * 回写响应 - * - * @param response - * @param changedGroups - */ private void generateResponse(HttpServletResponse response, List changedGroups) { if (!CollectionUtils.isEmpty(changedGroups)) { try { @@ -266,4 +259,5 @@ public class LongPollingService { } } } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/SwitchService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/SwitchService.java index d52607c7..3c835a05 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/SwitchService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/SwitchService.java @@ -7,7 +7,7 @@ import java.util.HashMap; import java.util.Map; /** - * SwitchService. + * Switch service. * * @author chen.ma * @date 2021/6/23 18:23 @@ -47,4 +47,5 @@ public class SwitchService { } return rtn; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigService.java index ce0a9cd4..b0bf6028 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigService.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.service.biz; import com.github.dynamic.threadpool.config.model.ConfigAllInfo; /** - * 服务端配置接口 + * Config service. * * @author chen.ma * @date 2021/6/20 15:18 @@ -11,19 +11,20 @@ import com.github.dynamic.threadpool.config.model.ConfigAllInfo; public interface ConfigService { /** - * 查询配置全部信息 + * Find config all info. * * @param tpId tpId * @param itemId itemId * @param tenantId tenantId - * @return 全部配置信息 + * @return all config */ ConfigAllInfo findConfigAllInfo(String tpId, String itemId, String tenantId); /** - * 新增或修改 + * Insert or update. * * @param configAllInfo */ void insertOrUpdate(ConfigAllInfo configAllInfo); + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigServiceImpl.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigServiceImpl.java index ad55fca7..aba12baa 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigServiceImpl.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ConfigServiceImpl.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; /** - * 服务端配置接口实现 + * Config service impl. * * @author chen.ma * @date 2021/6/20 15:21 diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemService.java index 73e07f6c..3b9e565f 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemService.java @@ -9,7 +9,7 @@ import com.github.dynamic.threadpool.config.model.biz.item.ItemUpdateReqDTO; import java.util.List; /** - * Item Service. + * Item service. * * @author chen.ma * @date 2021/6/29 21:57 @@ -17,7 +17,7 @@ import java.util.List; public interface ItemService { /** - * 分页查询 + * Query item page. * * @param reqDTO * @return @@ -25,7 +25,7 @@ public interface ItemService { IPage queryItemPage(ItemQueryReqDTO reqDTO); /** - * 根据 Id 获取项目 + * Query item by id. * * @param tenantId * @param itemId @@ -34,7 +34,7 @@ public interface ItemService { ItemRespDTO queryItemById(String tenantId, String itemId); /** - * 查询项目 + * Query item. * * @param reqDTO * @return @@ -42,24 +42,25 @@ public interface ItemService { List queryItem(ItemQueryReqDTO reqDTO); /** - * 新增项目 + * Save item. * * @param reqDTO */ void saveItem(ItemSaveReqDTO reqDTO); /** - * 修改项目 + * Update item. * * @param reqDTO */ void updateItem(ItemUpdateReqDTO reqDTO); /** - * 删除项目 + * Delete item. * * @param tenantId * @param itemId */ void deleteItem(String tenantId, String itemId); + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemServiceImpl.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemServiceImpl.java index cdfda65b..e8df8d74 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemServiceImpl.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ItemServiceImpl.java @@ -23,7 +23,7 @@ import javax.annotation.Resource; import java.util.List; /** - * Item Service Impl. + * Item service impl. * * @author chen.ma * @date 2021/6/29 21:58 @@ -78,7 +78,7 @@ public class ItemServiceImpl implements ItemService { boolean retBool = SqlHelper.retBool(insertResult); if (!retBool) { - throw new RuntimeException("插入失败."); + throw new RuntimeException("Save error"); } } @@ -92,7 +92,7 @@ public class ItemServiceImpl implements ItemService { boolean retBool = SqlHelper.retBool(updateResult); if (!retBool) { - throw new RuntimeException("修改失败."); + throw new RuntimeException("Update error."); } } @@ -100,7 +100,7 @@ public class ItemServiceImpl implements ItemService { public void deleteItem(String namespace, String itemId) { List itemList = threadPoolService.getThreadPoolByItemId(itemId); if (CollectionUtils.isNotEmpty(itemList)) { - throw new RuntimeException("项目包含线程池引用, 删除失败."); + throw new RuntimeException("The project contains a thread pool reference, and the deletion failed."); } int updateResult = itemInfoMapper.update(new ItemInfo(), @@ -110,7 +110,7 @@ public class ItemServiceImpl implements ItemService { .set(ItemInfo::getDelFlag, DelEnum.DELETE.getIntCode())); boolean retBool = SqlHelper.retBool(updateResult); if (!retBool) { - throw new RuntimeException("删除失败."); + throw new RuntimeException("Delete error."); } } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantService.java index 20067fd0..23ee1bfb 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantService.java @@ -7,7 +7,7 @@ import com.github.dynamic.threadpool.config.model.biz.tenant.TenantSaveReqDTO; import com.github.dynamic.threadpool.config.model.biz.tenant.TenantUpdateReqDTO; /** - * 业务接口 + * Tenant service. * * @author chen.ma * @date 2021/6/29 21:59 @@ -15,7 +15,7 @@ import com.github.dynamic.threadpool.config.model.biz.tenant.TenantUpdateReqDTO; public interface TenantService { /** - * 根据 Id 获取租户 + * Get tenant by id. * * @param tenantIdId * @return @@ -23,7 +23,7 @@ public interface TenantService { TenantRespDTO getTenantById(String tenantIdId); /** - * 分页查询租户 + * Query tenant page. * * @param reqDTO * @return @@ -31,21 +31,21 @@ public interface TenantService { IPage queryTenantPage(TenantQueryReqDTO reqDTO); /** - * 新增租户 + * Save tenant. * * @param reqDTO */ void saveTenant(TenantSaveReqDTO reqDTO); /** - * 修改租户 + * Update tenant. * * @param reqDTO */ void updateTenant(TenantUpdateReqDTO reqDTO); /** - * 根据 Id 删除租户 + * Delete tenant by id. * * @param tenantId */ diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantServiceImpl.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantServiceImpl.java index c6a21d15..5fbcef1b 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantServiceImpl.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/TenantServiceImpl.java @@ -24,7 +24,7 @@ import javax.annotation.Resource; import java.util.List; /** - * 业务接口 + * Tenant service impl. * * @author chen.ma * @date 2021/6/29 21:12 @@ -66,7 +66,7 @@ public class TenantServiceImpl implements TenantService { boolean retBool = SqlHelper.retBool(insertResult); if (!retBool) { - throw new RuntimeException("插入失败."); + throw new RuntimeException("Save Error."); } } @@ -77,7 +77,7 @@ public class TenantServiceImpl implements TenantService { .lambdaUpdate(TenantInfo.class).eq(TenantInfo::getTenantId, reqDTO.getTenantId())); boolean retBool = SqlHelper.retBool(updateResult); if (!retBool) { - throw new RuntimeException("修改失败."); + throw new RuntimeException("Update Error."); } } @@ -87,7 +87,7 @@ public class TenantServiceImpl implements TenantService { reqDTO.setTenantId(tenantId); List itemList = itemService.queryItem(reqDTO); if (CollectionUtils.isNotEmpty(itemList)) { - throw new RuntimeException("业务线包含项目引用, 删除失败."); + throw new RuntimeException("The line of business contains project references, and the deletion failed."); } int updateResult = tenantInfoMapper.update(new TenantInfo(), @@ -96,7 +96,7 @@ public class TenantServiceImpl implements TenantService { .set(TenantInfo::getDelFlag, DelEnum.DELETE.getIntCode())); boolean retBool = SqlHelper.retBool(updateResult); if (!retBool) { - throw new RuntimeException("删除失败."); + throw new RuntimeException("Delete error."); } } } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolService.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolService.java index fd745531..4301bc70 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolService.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolService.java @@ -8,7 +8,7 @@ import com.github.dynamic.threadpool.config.model.biz.threadpool.ThreadPoolSaveO import java.util.List; /** - * Thread Pool Service. + * Thread pool service. * * @author chen.ma * @date 2021/6/30 21:26 @@ -16,7 +16,7 @@ import java.util.List; public interface ThreadPoolService { /** - * 分页查询线程池 + * Query thread pool page. * * @param reqDTO * @return @@ -24,7 +24,7 @@ public interface ThreadPoolService { IPage queryThreadPoolPage(ThreadPoolQueryReqDTO reqDTO); /** - * 查询线程池配置 + * Get thread pool. * * @param reqDTO * @return @@ -32,7 +32,7 @@ public interface ThreadPoolService { ThreadPoolRespDTO getThreadPool(ThreadPoolQueryReqDTO reqDTO); /** - * 根据 ItemId 获取线程池配置 + * Get thread pool by item id. * * @param itemId * @return @@ -40,7 +40,7 @@ public interface ThreadPoolService { List getThreadPoolByItemId(String itemId); /** - * 新增或修改线程池配置 + * Save or update thread pool config. * * @param reqDTO */ diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolServiceImpl.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolServiceImpl.java index 44aebe23..16fa4e34 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolServiceImpl.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/service/biz/ThreadPoolServiceImpl.java @@ -17,7 +17,7 @@ import javax.annotation.Resource; import java.util.List; /** - * Thread Pool Service Impl. + * Thread pool service impl. * * @author chen.ma * @date 2021/6/30 21:26 @@ -57,4 +57,5 @@ public class ThreadPoolServiceImpl implements ThreadPoolService { public void saveOrUpdateThreadPoolConfig(ThreadPoolSaveOrUpdateReqDTO reqDTO) { configService.insertOrUpdate(BeanUtil.convert(reqDTO, ConfigAllInfo.class)); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/BeanUtil.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/BeanUtil.java index 2ff047fd..2b167bdf 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/BeanUtil.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/BeanUtil.java @@ -2,16 +2,11 @@ package com.github.dynamic.threadpool.config.toolkit; import com.github.dozermapper.core.DozerBeanMapperBuilder; import com.github.dozermapper.core.Mapper; -import com.github.dozermapper.core.loader.api.BeanMappingBuilder; -import java.lang.reflect.Array; import java.util.*; -import static com.github.dozermapper.core.loader.api.TypeMappingOptions.mapEmptyString; -import static com.github.dozermapper.core.loader.api.TypeMappingOptions.mapNull; - /** - * 对象复制工具类 + * Bean util * * @author chen.ma * @date 2021/3/19 15:40 @@ -28,30 +23,12 @@ public class BeanUtil { BEAN_MAPPER_BUILDER = DozerBeanMapperBuilder.buildDefault(); } - /** - * 复制单个对象 - * - * @param source 数据对象 - * @param clazz 复制目标类型 - * @param - * @param - * @return 转换后对象 - */ public static T convert(S source, Class clazz) { return Optional.ofNullable(source) .map(each -> BEAN_MAPPER_BUILDER.map(each, clazz)) .orElse(null); } - /** - * 复制多个对象 - * - * @param sources 数据对象 - * @param clazz 复制目标类型 - * @param - * @param - * @return 转换后对象集合 - */ public static List convert(List sources, Class clazz) { return Optional.ofNullable(sources) .map(each -> { @@ -63,15 +40,6 @@ public class BeanUtil { .orElse(null); } - /** - * 复制多个对象 - * - * @param sources 数据对象 - * @param clazz 复制目标类型 - * @param - * @param - * @return 转换后对象集合 - */ public static Set convert(Set sources, Class clazz) { return Optional.ofNullable(sources) .map(each -> { @@ -83,60 +51,4 @@ public class BeanUtil { .orElse(null); } - /** - * 复制多个对象 - * - * @param sources 数据对象 - * @param clazz 复制目标类型 - * @param - * @param - * @return 转换后对象集合 - */ - public static T[] convert(S[] sources, Class clazz) { - return Optional.ofNullable(sources) - .map(each -> { - @SuppressWarnings("unchecked") - T[] targetArray = (T[]) Array.newInstance(clazz, sources.length); - for (int i = 0; i < targetArray.length; i++) { - targetArray[i] = BEAN_MAPPER_BUILDER.map(sources[i], clazz); - } - return targetArray; - }) - .orElse(null); - } - - /** - * 拷贝非空且非空串属性 - * - * @param source 数据源 - * @param target 指向源 - */ - public static void convertIgnoreNullAndBlank(Object source, Object target) { - DozerBeanMapperBuilder dozerBeanMapperBuilder = DozerBeanMapperBuilder.create(); - Mapper mapper = dozerBeanMapperBuilder.withMappingBuilders(new BeanMappingBuilder() { - @Override - protected void configure() { - mapping(source.getClass(), target.getClass(), mapNull(false), mapEmptyString(false)); - } - }).build(); - mapper.map(source, target); - } - - /** - * 拷贝非空属性 - * - * @param source 数据源 - * @param target 指向源 - */ - public static void convertIgnoreNull(Object source, Object target) { - DozerBeanMapperBuilder dozerBeanMapperBuilder = DozerBeanMapperBuilder.create(); - Mapper mapper = dozerBeanMapperBuilder.withMappingBuilders(new BeanMappingBuilder() { - @Override - protected void configure() { - mapping(source.getClass(), target.getClass(), mapNull(false)); - } - }).build(); - mapper.map(source, target); - } - } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ClassUtil.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ClassUtil.java index 2fbea849..58fbb064 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ClassUtil.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ClassUtil.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.toolkit; import java.util.Objects; /** - * Class Util. + * Class util. * * @author chen.ma * @date 2021/6/23 19:03 @@ -19,4 +19,5 @@ public class ClassUtil { Objects.requireNonNull(cls, "cls"); return cls.getCanonicalName(); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ConfigExecutor.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ConfigExecutor.java index 44c6a8e4..ba4b0af6 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ConfigExecutor.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/ConfigExecutor.java @@ -7,7 +7,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; /** - * Config Executor. + * Config executor. * * @author chen.ma * @date 2021/6/23 18:33 @@ -29,4 +29,5 @@ public class ConfigExecutor { public static void scheduleLongPolling(Runnable runnable, long initialDelay, long period, TimeUnit unit) { LONG_POLLING_EXECUTOR.scheduleWithFixedDelay(runnable, initialDelay, period, unit); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/MapUtil.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/MapUtil.java index ee3cd21d..0a2ee3b0 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/MapUtil.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/MapUtil.java @@ -5,7 +5,7 @@ import java.util.Objects; import java.util.function.BiFunction; /** - * Map Util. + * Map util. * * @author chen.ma * @date 2021/6/23 19:09 @@ -27,4 +27,5 @@ public class MapUtil { } return val; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/Md5ConfigUtil.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/Md5ConfigUtil.java index 1aa511cb..5550bdd5 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/Md5ConfigUtil.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/Md5ConfigUtil.java @@ -19,7 +19,7 @@ import static com.github.dynamic.threadpool.common.constant.Constants.WORD_SEPAR /** - * Md5 配置组件 + * Md5 config util. * * @author chen.ma * @date 2021/6/21 18:32 @@ -31,7 +31,7 @@ public class Md5ConfigUtil { static final char LINE_SEPARATOR_CHAR = (char) 1; /** - * 获取 ThreadPool 相关内容 Md5 值 + * Get thread pool content md5 * * @param config * @return @@ -41,7 +41,7 @@ public class Md5ConfigUtil { } /** - * 比较客户端 Md5 与服务端是否一致 + * Compare whether the client Md5 is consistent with the server. * * @param request * @param clientMd5Map @@ -149,4 +149,5 @@ public class Md5ConfigUtil { return URLEncoder.encode(sb.toString(), "UTF-8"); } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/RequestUtil.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/RequestUtil.java index b7154ed1..1c7cd05e 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/RequestUtil.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/RequestUtil.java @@ -5,7 +5,7 @@ import org.springframework.util.StringUtils; import javax.servlet.http.HttpServletRequest; /** - * Request Util. + * Request util. * * @author chen.ma * @date 2021/6/23 18:28 @@ -26,4 +26,5 @@ public class RequestUtil { String nginxHeader = request.getHeader(X_REAL_IP); return StringUtils.isEmpty(nginxHeader) ? request.getRemoteAddr() : nginxHeader; } + } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SimpleReadWriteLock.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SimpleReadWriteLock.java index 25460aab..3f9d7ca5 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SimpleReadWriteLock.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SimpleReadWriteLock.java @@ -1,13 +1,15 @@ package com.github.dynamic.threadpool.config.toolkit; /** - * 简单读写锁. + * Simple read write lock. * * @author chen.ma * @date 2021/6/24 21:26 */ public class SimpleReadWriteLock { + private int status = 0; + public synchronized boolean tryReadLock() { if (isWriteLocked()) { return false; @@ -42,5 +44,4 @@ public class SimpleReadWriteLock { return status == 0; } - private int status = 0; } diff --git a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SingletonRepository.java b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SingletonRepository.java index 04b7874b..9f868e65 100644 --- a/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SingletonRepository.java +++ b/dynamic-threadpool-config/src/main/java/com/github/dynamic/threadpool/config/toolkit/SingletonRepository.java @@ -3,7 +3,7 @@ package com.github.dynamic.threadpool.config.toolkit; import java.util.concurrent.ConcurrentHashMap; /** - * Singleton Repository. + * Singleton repository. * * @author chen.ma * @date 2021/6/24 21:28 @@ -37,4 +37,5 @@ public class SingletonRepository { static SingletonRepository cache = new SingletonRepository(); } + }