From 8f4dcda73eb7630f6084592ad7e12db1f4d16d3e Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Thu, 11 Aug 2022 22:09:42 +0800 Subject: [PATCH] Remove extra spaces --- .../core/executor/ThreadPoolNotifyAlarmHandler.java | 10 ---------- .../cn/hippo4j/core/executor/support/TaskQueue.java | 2 -- .../core/inittest/RegisterDynamicThreadPoolTest.java | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java index 20d9086e..de06d187 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/ThreadPoolNotifyAlarmHandler.java @@ -220,17 +220,11 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner AlarmNotifyRequest request = new AlarmNotifyRequest(); String appName = StrUtil.isBlank(itemId) ? applicationName : itemId; request.setAppName(appName); - // 核心线程数 int corePoolSize = threadPoolExecutor.getCorePoolSize(); - // 最大线程数 int maximumPoolSize = threadPoolExecutor.getMaximumPoolSize(); - // 线程池当前线程数 (有锁) int poolSize = threadPoolExecutor.getPoolSize(); - // 活跃线程数 (有锁) int activeCount = threadPoolExecutor.getActiveCount(); - // 同时进入池中的最大线程数 (有锁) int largestPoolSize = threadPoolExecutor.getLargestPoolSize(); - // 线程池中执行任务总数量 (有锁) long completedTaskCount = threadPoolExecutor.getCompletedTaskCount(); request.setActive(active.toUpperCase()); request.setIdentify(IdentifyUtil.getIdentify()); @@ -241,13 +235,9 @@ public class ThreadPoolNotifyAlarmHandler implements Runnable, CommandLineRunner request.setLargestPoolSize(largestPoolSize); request.setCompletedTaskCount(completedTaskCount); BlockingQueue queue = threadPoolExecutor.getQueue(); - // 队列元素个数 int queueSize = queue.size(); - // 队列类型 String queueType = queue.getClass().getSimpleName(); - // 队列剩余容量 int remainingCapacity = queue.remainingCapacity(); - // 队列容量 int queueCapacity = queueSize + remainingCapacity; request.setQueueName(queueType); request.setCapacity(queueCapacity); diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java index 479387c4..3d16c439 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/TaskQueue.java @@ -45,13 +45,11 @@ public class TaskQueue extends LinkedBlockingQueue if (executor.getSubmittedTaskCount() < currentPoolThreadSize) { return super.offer(runnable); } - // The current number of threads in the thread pool is less than the maximum number of threads, and returns false. // According to the thread pool source code, non-core threads will be created. if (currentPoolThreadSize < executor.getMaximumPoolSize()) { return false; } - // If the current thread pool number is greater than the maximum number of threads, the task is added to the blocking queue. return super.offer(runnable); } diff --git a/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RegisterDynamicThreadPoolTest.java b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RegisterDynamicThreadPoolTest.java index c541a6f2..54105fbc 100644 --- a/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RegisterDynamicThreadPoolTest.java +++ b/hippo4j-example/hippo4j-example-core/src/main/java/cn/hippo4j/example/core/inittest/RegisterDynamicThreadPoolTest.java @@ -42,7 +42,7 @@ public class RegisterDynamicThreadPoolTest { .maximumPoolSize(10) .queueType(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.type) .capacity(110) - // TimeUnit.SECONDS + // TimeUnit.SECONDS .keepAliveTime(100L) // TimeUnit.MILLISECONDS .executeTimeOut(800L)