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

24
LINES

< > BotCompany Repo | #1034176 // renderUserThreadsWithStackTraces (backup)

JavaX fragment (include)

1  
static S renderUserThreadsWithStackTraces() {
2  
  ret renderUserThreadsWithStackTraces(Thread.getAllStackTraces());
3  
}
4  
5  
static S renderUserThreadsWithStackTraces(Map<Thread, StackTraceElement[]> threadMap) {
6  
  ret renderUserThreadsWithStackTraces(threadMap, "user thread");
7  
}
8  
9  
static S renderUserThreadsWithStackTraces(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  
    }
20  
    printTo(buf);
21  
  }
22  
  printTo(buf, n(n, threadDescription) + ".");
23  
  ret asciiHeading2(n(n, threadDescription) + " (+" + (l(threadMap)-n)  + ")") + "\n" + buf;
24  
}

Author comment

Began life as a copy of #1010502

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034176
Snippet name: renderUserThreadsWithStackTraces (backup)
Eternal ID of this version: #1034176/1
Text MD5: e8b1a168ef9f7ed7601f5680ad730684
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-25 20:46:19
Source code size: 865 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 76 / 96
Referenced in: [show references]