From 5798a07b7b2aa0a83807312a98446201031bc3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=A7=B0=20Ma=20Chen?= Date: Sat, 5 Nov 2022 00:03:27 +0800 Subject: [PATCH] Format code (#907) --- .../constant/ConfigModifyTypeConstants.java | 3 +++ .../common/executor/ThreadPoolManager.java | 5 +---- .../hippo4j/common/toolkit/ContentUtil.java | 20 +++++++++++++++++-- .../cn/hippo4j/common/toolkit/Joiner.java | 10 +++++----- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/constant/ConfigModifyTypeConstants.java b/hippo4j-common/src/main/java/cn/hippo4j/common/constant/ConfigModifyTypeConstants.java index 84a8bf61..deb4465c 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/constant/ConfigModifyTypeConstants.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/constant/ConfigModifyTypeConstants.java @@ -17,6 +17,9 @@ package cn.hippo4j.common.constant; +/** + * Config modify type constants. + */ public class ConfigModifyTypeConstants { /** diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/ThreadPoolManager.java b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/ThreadPoolManager.java index b38d104f..aa3be5bd 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/executor/ThreadPoolManager.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/executor/ThreadPoolManager.java @@ -23,12 +23,11 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicBoolean; /** * Thread-pool manager. */ -public class ThreadPoolManager { +public final class ThreadPoolManager { private Map>> resourcesManager; @@ -36,8 +35,6 @@ public class ThreadPoolManager { private static final ThreadPoolManager INSTANCE = new ThreadPoolManager(); - private static final AtomicBoolean CLOSED = new AtomicBoolean(false); - public static ThreadPoolManager getInstance() { return INSTANCE; } diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ContentUtil.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ContentUtil.java index 68e19378..ae5b6dfe 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ContentUtil.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/ContentUtil.java @@ -21,13 +21,17 @@ import cn.hippo4j.common.constant.Constants; import cn.hippo4j.common.model.ThreadPoolParameter; import cn.hippo4j.common.model.ThreadPoolParameterInfo; -import java.util.Objects; - /** * Content util. */ public class ContentUtil { + /** + * Get pool content. + * + * @param parameter thread-pool parameter + * @return dynamic thread-pool content str + */ public static String getPoolContent(ThreadPoolParameter parameter) { ThreadPoolParameterInfo threadPoolParameterInfo = new ThreadPoolParameterInfo(); threadPoolParameterInfo.setTenantId(parameter.getTenantId()) @@ -47,6 +51,12 @@ public class ContentUtil { return JSONUtil.toJSONString(threadPoolParameterInfo); } + /** + * Get group key. + * + * @param parameter thread-pool parameter + * @return group key + */ public static String getGroupKey(ThreadPoolParameter parameter) { return StringUtil.createBuilder() .append(parameter.getTpId()) @@ -57,6 +67,12 @@ public class ContentUtil { .toString(); } + /** + * Get group key. + * + * @param parameters thread-pool parameters + * @return group key + */ public static String getGroupKey(String... parameters) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < parameters.length; i++) { diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Joiner.java b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Joiner.java index de798647..b6130d94 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Joiner.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/toolkit/Joiner.java @@ -26,7 +26,7 @@ import java.util.Objects; * reference google guava
* com.google.common.base.Joiner */ -public class Joiner { +public final class Joiner { private final String separator; @@ -45,11 +45,11 @@ public class Joiner { * Returns a string containing the string representation of each of {@code parts}, using the * previously configured separator between each. */ - public final String join(Object[] parts) { + public String join(Object[] parts) { return join(Arrays.asList(parts)); } - public final String join(Iterable parts) { + public String join(Iterable parts) { return join(parts.iterator()); } @@ -57,11 +57,11 @@ public class Joiner { * Returns a string containing the string representation of each of {@code parts}, using the * previously configured separator between each. */ - public final String join(Iterator parts) { + public String join(Iterator parts) { return appendTo(new StringBuilder(), parts).toString(); } - public final StringBuilder appendTo(StringBuilder builder, Iterator parts) { + public StringBuilder appendTo(StringBuilder builder, Iterator parts) { try { appendTo((Appendable) builder, parts); } catch (IOException impossible) {