|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|