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

16
LINES

< > BotCompany Repo | #1000960 // listUserThreadsWithStackTraces

JavaX fragment (include)

static void listUserThreadsWithStackTraces() {
  printAsciiHeading("Threads");
  Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
  int n = 0;
  for (Thread t : threadMap.keySet()) {
    ThreadGroup g = t.getThreadGroup();
    if (g != null && g.getName().equals("system")) continue;
    ++n;
    print(t);
    for (StackTraceElement e : threadMap.get(t)) {
      print("  " + e);
    }
    print();
  }
  print(n + " user threads.");
}

Author comment

Began life as a copy of #1000959

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: #1000960
Snippet name: listUserThreadsWithStackTraces
Eternal ID of this version: #1000960/2
Text MD5: 92953546d4a5be0b70a3c921b551a9c5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-12 22:00:44
Source code size: 475 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 609 / 899
Version history: 1 change(s)
Referenced in: [show references]