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

14
LINES

< > BotCompany Repo | #1006554 // Show various thread counts from ThreadMXBean

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (487L/4K/13K).

1  
!7
2  
3  
p {
4  
  ThreadMXBean mx = ManagementFactory.getThreadMXBean();
5  
  for (S variant : ll("", "Peak", "TotalStarted", "Daemon"))
6  
    print(variant + "ThreadCount: " + call(mx, "get" + variant + "ThreadCount"));
7  
    
8  
  // Apparently the only way to find all non-daemon threads
9  
  Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
10  
  for (Thread t : threadMap.keySet()) {
11  
    if (t.isDaemon()) continue;
12  
    print("Thread: " + t.getName());
13  
  }
14  
}

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: #1006554
Snippet name: Show various thread counts from ThreadMXBean
Eternal ID of this version: #1006554/1
Text MD5: 4a87a34b81dc0d57ef77b43c2846c738
Transpilation MD5: f5c463a7840971c753da8cc0f347f2f1
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-01-16 11:57:32
Source code size: 475 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 476 / 587
Referenced in: [show references]