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).

!7

p {
  ThreadMXBean mx = ManagementFactory.getThreadMXBean();
  for (S variant : ll("", "Peak", "TotalStarted", "Daemon"))
    print(variant + "ThreadCount: " + call(mx, "get" + variant + "ThreadCount"));
    
  // Apparently the only way to find all non-daemon threads
  Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
  for (Thread t : threadMap.keySet()) {
    if (t.isDaemon()) continue;
    print("Thread: " + t.getName());
  }
}

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