Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1016147 // renderAllThreadsWithStackTraces

JavaX fragment (include)

1  
static S renderAllThreadsWithStackTraces() {
2  
  ret renderAllThreadsWithStackTraces(Thread.getAllStackTraces());
3  
}
4  
5  
static S renderAllThreadsWithStackTraces(Map<Thread, StackTraceElement[]> threadMap) {
6  
  ret renderAllThreadsWithStackTraces(threadMap, "thread");
7  
}
8  
9  
static S renderAllThreadsWithStackTraces(Map<Thread, StackTraceElement[]> threadMap, S threadDescription) {
10  
  new StringBuilder buf;
11  
  int n = 0;
12  
  for (Thread t : threadMap.keySet()) {
13  
    ThreadGroup g = t.getThreadGroup();
14  
    //if (g != null && g.getName().equals("system")) continue;
15  
    ++n;
16  
    printTo(buf, t);
17  
    for (StackTraceElement e : threadMap.get(t))
18  
      printTo(buf, "  " + e);
19  
    printTo(buf);
20  
  }
21  
  printTo(buf, n(n, threadDescription) + ".");
22  
  ret asciiHeading2(n2(n, threadDescription)) + "\n" + buf;
23  
}

Author comment

Began life as a copy of #1010502

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016147
Snippet name: renderAllThreadsWithStackTraces
Eternal ID of this version: #1016147/4
Text MD5: 84a75374cf85df6f48a385064386d2b4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-12-18 14:19:22
Source code size: 815 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 512 / 545
Version history: 3 change(s)
Referenced in: [show references]