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

14
LINES

< > BotCompany Repo | #1009292 // printDeadlocks - print list of deadlocked threads; returns the list of deadlocked ThreadInfo objects

JavaX fragment (include)

1  
static volatile L<ThreadInfo> printDeadlocks_lastDeadlock;
2  
3  
static L<ThreadInfo> printDeadlocks() {
4  
  ThreadMXBean bean = ManagementFactory.getThreadMXBean();
5  
  long ids[] = bean.findDeadlockedThreads();
6  
  if (empty(ids)) ret emptyList();
7  
  
8  
  printAsciiHeading(upper(n2(ids, "deadlocked thread")));
9  
  ThreadInfo threadInfo[] = bean.getThreadInfo(ids);
10  
  print("Got " + n2(threadInfo, "thread info"));
11  
  S info = print(deadlockedThreadsToString(asList(threadInfo)));
12  
  appendToFile(javaxDataDir("deadlocks.txt"), "\n\n" + localDateWithSeconds() + "\n\n" + info);
13  
  ret printDeadlocks_lastDeadlock = asList(threadInfo);
14  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009292
Snippet name: printDeadlocks - print list of deadlocked threads; returns the list of deadlocked ThreadInfo objects
Eternal ID of this version: #1009292/12
Text MD5: 8639fc7c92e4133d127dfcc3807fbcd1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-22 08:55:03
Source code size: 633 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 588
Version history: 11 change(s)
Referenced in: [show references]