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

16
LINES

< > BotCompany Repo | #1000960 // listUserThreadsWithStackTraces

JavaX fragment (include)

1  
static void listUserThreadsWithStackTraces() {
2  
  printAsciiHeading("Threads");
3  
  Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
4  
  int n = 0;
5  
  for (Thread t : threadMap.keySet()) {
6  
    ThreadGroup g = t.getThreadGroup();
7  
    if (g != null && g.getName().equals("system")) continue;
8  
    ++n;
9  
    print(t);
10  
    for (StackTraceElement e : threadMap.get(t)) {
11  
      print("  " + e);
12  
    }
13  
    print();
14  
  }
15  
  print(n + " user threads.");
16  
}

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: 629 / 924
Version history: 1 change(s)
Referenced in: [show references]