From 23a9b2617efdf1512895b68bf937ad079496f0f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=A7=B0?= Date: Fri, 28 Oct 2022 20:58:18 +0800 Subject: [PATCH] Supplemental code comments (#860) --- .../manage/GlobalNotifyAlarmManage.java | 15 +++++++ .../manage/GlobalThreadPoolManage.java | 39 +++++++++---------- 2 files changed, 34 insertions(+), 20 deletions(-) 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 5f680e44..fee2a1ee 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 @@ -27,12 +27,27 @@ import java.util.concurrent.ConcurrentHashMap; */ public class GlobalNotifyAlarmManage { + /** + * Notify alarm map. + */ private static final Map NOTIFY_ALARM_MAP = new ConcurrentHashMap(); + /** + * Get thread-pool notify alarm. + * + * @param key thread-pool key + * @return thread-pool notify alarm + */ public static ThreadPoolNotifyAlarm get(String key) { return NOTIFY_ALARM_MAP.get(key); } + /** + * Put thread-pool notify alarm. + * + * @param key thread-pool key + * @param val thread-pool notify alarm + */ public static void put(String key, ThreadPoolNotifyAlarm val) { NOTIFY_ALARM_MAP.put(key, val); } 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 a3800b30..4b189fec 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 @@ -48,8 +48,8 @@ public class GlobalThreadPoolManage { /** * Get the dynamic thread pool wrapper class. * - * @param threadPoolId - * @return + * @param threadPoolId thread-pool id + * @return dynamic thread-pool wrapper */ public static DynamicThreadPoolWrapper getExecutorService(String threadPoolId) { return EXECUTOR_MAP.get(threadPoolId); @@ -58,8 +58,8 @@ public class GlobalThreadPoolManage { /** * Get the dynamic thread pool wrapper class. * - * @param threadPoolId - * @return + * @param threadPoolId thread-pool id + * @return thread-pool executor */ public static ThreadPoolExecutor getExecutor(String threadPoolId) { return Optional.ofNullable(EXECUTOR_MAP.get(threadPoolId)).map(each -> each.getExecutor()).orElse(null); @@ -68,8 +68,8 @@ public class GlobalThreadPoolManage { /** * Get dynamic thread pool parameters. * - * @param threadPoolId - * @return + * @param threadPoolId thread-pool id + * @return thread-pool parameter */ public static ThreadPoolParameter getPoolParameter(String threadPoolId) { return POOL_PARAMETER.get(threadPoolId); @@ -78,9 +78,9 @@ public class GlobalThreadPoolManage { /** * Register dynamic thread pool wrapper and parameters. * - * @param threadPoolId - * @param threadPoolParameter - * @param executor + * @param threadPoolId thread-pool id + * @param threadPoolParameter thread-pool parameter + * @param executor executor */ public static void register(String threadPoolId, ThreadPoolParameter threadPoolParameter, DynamicThreadPoolWrapper executor) { registerPool(threadPoolId, executor); @@ -90,8 +90,8 @@ public class GlobalThreadPoolManage { /** * Register dynamic thread pool. * - * @param threadPoolId - * @param executor + * @param threadPoolId thread-pool id + * @param executor executor */ public static void registerPool(String threadPoolId, DynamicThreadPoolWrapper executor) { EXECUTOR_MAP.put(threadPoolId, executor); @@ -100,17 +100,17 @@ public class GlobalThreadPoolManage { /** * Register dynamic thread pool parameters. * - * @param threadPoolId - * @param poolParameter + * @param threadPoolId thread-pool id + * @param threadPoolParameter thread-pool parameter */ - public static void registerPoolParameter(String threadPoolId, ThreadPoolParameter poolParameter) { - POOL_PARAMETER.put(threadPoolId, poolParameter); + public static void registerPoolParameter(String threadPoolId, ThreadPoolParameter threadPoolParameter) { + POOL_PARAMETER.put(threadPoolId, threadPoolParameter); } /** * Dynamically register thread pool records and notification records. * - * @param registerWrapper + * @param registerWrapper register wrapper */ public static ThreadPoolExecutor dynamicRegister(DynamicThreadPoolRegisterWrapper registerWrapper) { DynamicThreadPoolService dynamicThreadPoolService = ApplicationContextHolder.getBean(DynamicThreadPoolService.class); @@ -120,7 +120,7 @@ public class GlobalThreadPoolManage { /** * Get the dynamic thread pool identifier collection. * - * @return + * @return thread-pool id list */ public static List listThreadPoolId() { return new ArrayList<>(EXECUTOR_MAP.keySet()); @@ -128,11 +128,10 @@ public class GlobalThreadPoolManage { /** * Get the number of dynamic thread pools. - *

- * The data may be inaccurate when the project is initially + *

The data may be inaccurate when the project is initially * launched because registration is done asynchronously. * - * @return + * @return thread-pool num */ public static Integer getThreadPoolNum() { return listThreadPoolId().size();