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

24
LINES

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

JavaX fragment (include)

static S renderUserThreadsWithStackTraces() {
  ret renderUserThreadsWithStackTraces(Thread.getAllStackTraces());
}

static S renderUserThreadsWithStackTraces(Map<Thread, StackTraceElement[]> threadMap) {
  ret renderUserThreadsWithStackTraces(threadMap, "user thread");
}

static S renderUserThreadsWithStackTraces(Map<Thread, StackTraceElement[]> threadMap, S threadDescription) {
  new StringBuilder buf;
  int n = 0;
  for (Thread t : threadMap.keySet()) {
    ThreadGroup g = t.getThreadGroup();
    if (g != null && g.getName().equals("system")) continue;
    ++n;
    printTo(buf, t);
    for (StackTraceElement e : threadMap.get(t)) {
      printTo(buf, "  " + e);
    }
    printTo(buf);
  }
  printTo(buf, n(n, threadDescription) + ".");
  ret asciiHeading2(n(n, threadDescription) + " (+" + (l(threadMap)-n)  + ")") + "\n" + buf;
}

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: 175 / 202
Referenced in: [show references]