fix thread command NullPointerException. #2875

pull/2879/head
hengyunabc 6 months ago
parent 02bd68ab40
commit cfea6d18e5

@ -212,8 +212,10 @@ public class ThreadCommand extends AnnotatedCommand {
List<BusyThreadInfo> busyThreadInfos = new ArrayList<BusyThreadInfo>(topNThreads.size());
for (ThreadVO thread : topNThreads) {
ThreadInfo threadInfo = findThreadInfoById(threadInfos, thread.getId());
BusyThreadInfo busyThread = new BusyThreadInfo(thread, threadInfo);
busyThreadInfos.add(busyThread);
if (threadInfo != null) {
BusyThreadInfo busyThread = new BusyThreadInfo(thread, threadInfo);
busyThreadInfos.add(busyThread);
}
}
process.appendResult(new ThreadModel(busyThreadInfos));
return ExitStatus.success();

@ -266,6 +266,9 @@ abstract public class ThreadUtil {
}
public static String getFullStacktrace(BusyThreadInfo threadInfo, int lockIdentityHashCode, int blockingThreadCount) {
if (threadInfo == null) {
return "";
}
StringBuilder sb = new StringBuilder("\"" + threadInfo.getName() + "\"");
if (threadInfo.getId() > 0) {
sb.append(" Id=").append(threadInfo.getId());

Loading…
Cancel
Save