修复 ThreadUtil.getMainThread在JDK25中返回null的问题(pr#1416@Gitee)

This commit is contained in:
Looly
2025-12-24 18:22:44 +08:00
parent cea3d93305
commit 2b9d3fbbd8

View File

@@ -700,7 +700,7 @@ public class ThreadUtil {
*/
public static Thread getMainThread() {
for (final Thread thread : getThreads()) {
if (thread.getId() == 1) {
if (thread.getId() == 1 || "main".equals(thread.getName())) {
return thread;
}
}