Skip to content

Commit

Permalink
fix thread command NullPointerException. #2875
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Jul 25, 2024
1 parent 02bd68a commit cfea6d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ private ExitStatus processTopBusyThreads(CommandProcess process) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ public static String getFullStacktrace(ThreadInfo threadInfo, double cpuUsage, l
}

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());
Expand Down

0 comments on commit cfea6d1

Please sign in to comment.