diff --git a/common/src/main/java/io/dynamic/threadpool/common/constant/Constants.java b/common/src/main/java/io/dynamic/threadpool/common/constant/Constants.java index 6e46ac9c..e6815d9b 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/constant/Constants.java +++ b/common/src/main/java/io/dynamic/threadpool/common/constant/Constants.java @@ -26,7 +26,7 @@ public class Constants { public static final String GENERAL_SPLIT_SYMBOL = ","; - public static final String LONGPOLLING_LINE_SEPARATOR = "\r\n"; + public static final String LONG_POLLING_LINE_SEPARATOR = "\r\n"; public static final String BASE_PATH = "/v1/cs"; diff --git a/common/src/main/java/io/dynamic/threadpool/common/executor/ThreadPoolManager.java b/common/src/main/java/io/dynamic/threadpool/common/executor/ThreadPoolManager.java index e379ed38..e994c0ea 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/executor/ThreadPoolManager.java +++ b/common/src/main/java/io/dynamic/threadpool/common/executor/ThreadPoolManager.java @@ -33,7 +33,7 @@ public class ThreadPoolManager { } private void init() { - resourcesManager = new ConcurrentHashMap>>(8); + resourcesManager = new ConcurrentHashMap(8); } public void register(String tenantId, String group, ExecutorService executor) { diff --git a/common/src/main/java/io/dynamic/threadpool/common/model/PoolParameterInfo.java b/common/src/main/java/io/dynamic/threadpool/common/model/PoolParameterInfo.java index b834dd69..8b8da771 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/model/PoolParameterInfo.java +++ b/common/src/main/java/io/dynamic/threadpool/common/model/PoolParameterInfo.java @@ -1,6 +1,7 @@ package io.dynamic.threadpool.common.model; import lombok.Data; +import lombok.experimental.Accessors; import java.io.Serializable; @@ -11,6 +12,7 @@ import java.io.Serializable; * @date 2021/6/16 23:18 */ @Data +@Accessors(chain = true) public class PoolParameterInfo implements PoolParameter, Serializable { private static final long serialVersionUID = -7123935122108553864L; diff --git a/common/src/main/java/io/dynamic/threadpool/common/model/PoolRunStateInfo.java b/common/src/main/java/io/dynamic/threadpool/common/model/PoolRunStateInfo.java index 16218be2..52bfffc1 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/model/PoolRunStateInfo.java +++ b/common/src/main/java/io/dynamic/threadpool/common/model/PoolRunStateInfo.java @@ -89,4 +89,5 @@ public class PoolRunStateInfo implements Serializable { * Host */ private String host; + } diff --git a/common/src/main/java/io/dynamic/threadpool/common/toolkit/ContentUtil.java b/common/src/main/java/io/dynamic/threadpool/common/toolkit/ContentUtil.java index 8fc7af44..41d5e6a4 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/toolkit/ContentUtil.java +++ b/common/src/main/java/io/dynamic/threadpool/common/toolkit/ContentUtil.java @@ -13,34 +13,20 @@ import io.dynamic.threadpool.common.model.PoolParameterInfo; */ public class ContentUtil { - /*public static String getPoolContent(PoolParameter parameter) { - StringBuilder stringBuilder = new StringBuilder(); - String resultStr = stringBuilder.append(parameter.getCoreSize()) - .append(parameter.getMaxSize()) - .append(parameter.getQueueType()) - .append(parameter.getCapacity()) - .append(parameter.getKeepAliveTime()) - .append(parameter.getIsAlarm()) - .append(parameter.getCapacityAlarm()) - .append(parameter.getLivenessAlarm()) - .toString(); - return resultStr; - }*/ - public static String getPoolContent(PoolParameter parameter) { PoolParameterInfo poolInfo = new PoolParameterInfo(); - poolInfo.setTenantId(parameter.getTenantId()); - poolInfo.setItemId(parameter.getItemId()); - poolInfo.setTpId(parameter.getTpId()); - poolInfo.setCoreSize(parameter.getCoreSize()); - poolInfo.setMaxSize(parameter.getMaxSize()); - poolInfo.setQueueType(parameter.getQueueType()); - poolInfo.setCapacity(parameter.getCapacity()); - poolInfo.setKeepAliveTime(parameter.getKeepAliveTime()); - poolInfo.setIsAlarm(parameter.getIsAlarm()); - poolInfo.setCapacityAlarm(parameter.getCapacityAlarm()); - poolInfo.setLivenessAlarm(parameter.getLivenessAlarm()); - poolInfo.setRejectedType(parameter.getRejectedType()); + poolInfo.setTenantId(parameter.getTenantId()) + .setItemId(parameter.getItemId()) + .setTpId(parameter.getTpId()) + .setCoreSize(parameter.getCoreSize()) + .setMaxSize(parameter.getMaxSize()) + .setQueueType(parameter.getQueueType()) + .setCapacity(parameter.getCapacity()) + .setKeepAliveTime(parameter.getKeepAliveTime()) + .setIsAlarm(parameter.getIsAlarm()) + .setCapacityAlarm(parameter.getCapacityAlarm()) + .setLivenessAlarm(parameter.getLivenessAlarm()) + .setRejectedType(parameter.getRejectedType()); return JSON.toJSONString(poolInfo); } diff --git a/common/src/main/java/io/dynamic/threadpool/common/toolkit/GroupKey.java b/common/src/main/java/io/dynamic/threadpool/common/toolkit/GroupKey.java index f189541a..ef13ef36 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/toolkit/GroupKey.java +++ b/common/src/main/java/io/dynamic/threadpool/common/toolkit/GroupKey.java @@ -9,6 +9,7 @@ import org.springframework.util.StringUtils; * @date 2021/6/24 21:12 */ public class GroupKey { + public static String getKey(String dataId, String group) { return getKey(dataId, group, ""); } @@ -34,12 +35,6 @@ public class GroupKey { return sb.toString(); } - /** - * Parse key. - * - * @param groupKey group key - * @return parsed key - */ public static String[] parseKey(String groupKey) { StringBuilder sb = new StringBuilder(); String dataId = null; @@ -88,9 +83,6 @@ public class GroupKey { return new String[]{dataId, group, tenant}; } - /** - * + -> %2B % -> %25. - */ public static void urlEncode(String str, StringBuilder sb) { for (int idx = 0; idx < str.length(); ++idx) { char c = str.charAt(idx); @@ -103,4 +95,5 @@ public class GroupKey { } } } + } diff --git a/common/src/main/java/io/dynamic/threadpool/common/web/base/Result.java b/common/src/main/java/io/dynamic/threadpool/common/web/base/Result.java index 638d99cb..ed2f85a1 100644 --- a/common/src/main/java/io/dynamic/threadpool/common/web/base/Result.java +++ b/common/src/main/java/io/dynamic/threadpool/common/web/base/Result.java @@ -32,4 +32,5 @@ public class Result implements Serializable { public boolean isFail() { return !isSuccess(); } + }