Change thread pool reject count name.

pull/161/head
chen.ma 3 years ago
parent d148789f45
commit 4c90c76fa3

@ -83,7 +83,7 @@ public class PoolRunStateInfo implements Serializable {
/** /**
* *
*/ */
private Integer regectCount; private Integer rejectCount;
/** /**
* Host * Host

@ -76,10 +76,10 @@ public class ThreadPoolRunStateHandler {
stateInfo.setHost(addr.getHostAddress()); stateInfo.setHost(addr.getHostAddress());
stateInfo.setTpId(tpId); stateInfo.setTpId(tpId);
int regectCount = pool instanceof CustomThreadPoolExecutor int rejectCount = pool instanceof CustomThreadPoolExecutor
? ((CustomThreadPoolExecutor) pool).getRegectCount() ? ((CustomThreadPoolExecutor) pool).getRejectCount()
: -1; : -1;
stateInfo.setRegectCount(regectCount); stateInfo.setRejectCount(rejectCount);
return stateInfo; return stateInfo;
} }

@ -23,7 +23,7 @@ import static com.github.dynamic.threadpool.common.constant.Constants.MAP_INITIA
*/ */
public final class CustomThreadPoolExecutor extends ThreadPoolExecutor { 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 final AtomicInteger ctl = new AtomicInteger(ctlOf(RUNNING, 0));
private static final int COUNT_BITS = Integer.SIZE - 3; private static final int COUNT_BITS = Integer.SIZE - 3;
@ -143,8 +143,8 @@ public final class CustomThreadPoolExecutor extends ThreadPoolExecutor {
} while (!compareAndDecrementWorkerCount(ctl.get())); } while (!compareAndDecrementWorkerCount(ctl.get()));
} }
public Integer getRegectCount() { public Integer getRejectCount() {
return regectCount.get(); return rejectCount.get();
} }
private final class Worker private final class Worker
@ -315,7 +315,7 @@ public final class CustomThreadPoolExecutor extends ThreadPoolExecutor {
private static final boolean ONLY_ONE = true; private static final boolean ONLY_ONE = true;
final void reject(Runnable command) { final void reject(Runnable command) {
regectCount.incrementAndGet(); rejectCount.incrementAndGet();
handler.rejectedExecution(command, this); handler.rejectedExecution(command, this);
} }

Loading…
Cancel
Save