Merge pull request #106 from iwangjie/bugfix/20220217/reduce_hutool_depend

Bugfix/20220217/reduce hutool depend
pull/110/head
龙台 Long Tai 3 years ago committed by GitHub
commit b1f8d48707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,7 +35,7 @@ public class ThreadPoolStatusHandler {
if (EXCEPTION_FLAG.get()) { if (EXCEPTION_FLAG.get()) {
try { try {
Method runStateLessThan = ReflectUtil.getMethodByName(ThreadPoolExecutor.class, "runStateLessThan"); Method runStateLessThan = ReflectUtil.getMethodByName(ThreadPoolExecutor.class, "runStateLessThan");
ReflectUtil.setAccessible(runStateLessThan); cn.hippo4j.common.toolkit.ReflectUtil.setAccessible(runStateLessThan);
AtomicInteger ctl = (AtomicInteger) ReflectUtil.getFieldValue(executor, "ctl"); AtomicInteger ctl = (AtomicInteger) ReflectUtil.getFieldValue(executor, "ctl");
int shutdown = (int) ReflectUtil.getFieldValue(executor, "SHUTDOWN"); int shutdown = (int) ReflectUtil.getFieldValue(executor, "SHUTDOWN");
@ -45,7 +45,7 @@ public class ThreadPoolStatusHandler {
} }
Method runStateAtLeast = ReflectUtil.getMethodByName(ThreadPoolExecutor.class, "runStateAtLeast"); Method runStateAtLeast = ReflectUtil.getMethodByName(ThreadPoolExecutor.class, "runStateAtLeast");
ReflectUtil.setAccessible(runStateAtLeast); cn.hippo4j.common.toolkit.ReflectUtil.setAccessible(runStateAtLeast);
int terminated = (int) ReflectUtil.getFieldValue(executor, "TERMINATED"); int terminated = (int) ReflectUtil.getFieldValue(executor, "TERMINATED");
String resultStatus = ReflectUtil.invoke(executor, runStateAtLeast, ctl.get(), terminated) ? TERMINATED : SHUTTING_DOWN; String resultStatus = ReflectUtil.invoke(executor, runStateAtLeast, ctl.get(), terminated) ? TERMINATED : SHUTTING_DOWN;
return resultStatus; return resultStatus;

Loading…
Cancel
Save