From 4c90c76fa3b72f0c9e1ae059a7686bca6049c8ea Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Sun, 15 Aug 2021 12:41:37 +0800 Subject: [PATCH] Change thread pool reject count name. --- .../dynamic/threadpool/common/model/PoolRunStateInfo.java | 2 +- .../starter/handler/ThreadPoolRunStateHandler.java | 6 +++--- .../starter/toolkit/thread/CustomThreadPoolExecutor.java | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java index 84c12098..c086ac90 100644 --- a/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java +++ b/dynamic-threadpool-common/src/main/java/com/github/dynamic/threadpool/common/model/PoolRunStateInfo.java @@ -83,7 +83,7 @@ public class PoolRunStateInfo implements Serializable { /** * 拒绝策略发生次数 */ - private Integer regectCount; + private Integer rejectCount; /** * Host diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/handler/ThreadPoolRunStateHandler.java b/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/handler/ThreadPoolRunStateHandler.java index cb36a3fd..3a64638a 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/handler/ThreadPoolRunStateHandler.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/handler/ThreadPoolRunStateHandler.java @@ -76,10 +76,10 @@ public class ThreadPoolRunStateHandler { stateInfo.setHost(addr.getHostAddress()); stateInfo.setTpId(tpId); - int regectCount = pool instanceof CustomThreadPoolExecutor - ? ((CustomThreadPoolExecutor) pool).getRegectCount() + int rejectCount = pool instanceof CustomThreadPoolExecutor + ? ((CustomThreadPoolExecutor) pool).getRejectCount() : -1; - stateInfo.setRegectCount(regectCount); + stateInfo.setRejectCount(rejectCount); return stateInfo; } diff --git a/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/toolkit/thread/CustomThreadPoolExecutor.java b/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/toolkit/thread/CustomThreadPoolExecutor.java index 0f30025d..1d477a0e 100644 --- a/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/toolkit/thread/CustomThreadPoolExecutor.java +++ b/dynamic-threadpool-spring-boot-starter/src/main/java/com/github/dynamic/threadpool/starter/toolkit/thread/CustomThreadPoolExecutor.java @@ -23,7 +23,7 @@ import static com.github.dynamic.threadpool.common.constant.Constants.MAP_INITIA */ public final class CustomThreadPoolExecutor extends ThreadPoolExecutor { - private final AtomicInteger regectCount = new AtomicInteger(); + private final AtomicInteger rejectCount = new AtomicInteger(); private final AtomicInteger ctl = new AtomicInteger(ctlOf(RUNNING, 0)); private static final int COUNT_BITS = Integer.SIZE - 3; @@ -143,8 +143,8 @@ public final class CustomThreadPoolExecutor extends ThreadPoolExecutor { } while (!compareAndDecrementWorkerCount(ctl.get())); } - public Integer getRegectCount() { - return regectCount.get(); + public Integer getRejectCount() { + return rejectCount.get(); } private final class Worker @@ -315,7 +315,7 @@ public final class CustomThreadPoolExecutor extends ThreadPoolExecutor { private static final boolean ONLY_ONE = true; final void reject(Runnable command) { - regectCount.incrementAndGet(); + rejectCount.incrementAndGet(); handler.rejectedExecution(command, this); }