Merge branch '3.2' of https://github.com/apache/dubbo into 3.2

This commit is contained in:
wxbty 2024-01-09 20:52:07 +08:00
commit edf00b3af9
1 changed files with 10 additions and 8 deletions

View File

@ -156,13 +156,13 @@ public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy {
if (!guard.tryAcquire()) {
return;
}
// To avoid multiple dump, check again
if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
return;
}
ExecutorService pool = Executors.newSingleThreadExecutor();
ExecutorService pool = null;
try {
// To avoid multiple dump, check again
if (System.currentTimeMillis() - lastPrintTime < TEN_MINUTES_MILLS) {
return;
}
pool = Executors.newSingleThreadExecutor();
pool.execute(() -> {
String dumpPath = getDumpPath();
@ -186,12 +186,14 @@ public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy {
logger.error(COMMON_UNEXPECTED_CREATE_DUMP, "", "", "dump jStack error", t);
} finally {
lastPrintTime = System.currentTimeMillis();
guard.release();
}
});
} finally {
guard.release();
// must shutdown thread pool ,if not will lead to OOM
pool.shutdown();
if (pool != null) {
pool.shutdown();
}
}
}