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)

static volatile L<ThreadInfo> printDeadlocks_lastDeadlock;

static L<ThreadInfo> printDeadlocks() {
  ThreadMXBean bean = ManagementFactory.getThreadMXBean();
  long ids[] = bean.findDeadlockedThreads();
  if (empty(ids)) ret emptyList();
  
  printAsciiHeading(upper(n2(ids, "deadlocked thread")));
  ThreadInfo threadInfo[] = bean.getThreadInfo(ids);
  print("Got " + n2(threadInfo, "thread info"));
  S info = print(deadlockedThreadsToString(asList(threadInfo)));
  appendToFile(javaxDataDir("deadlocks.txt"), "\n\n" + localDateWithSeconds() + "\n\n" + info);
  ret printDeadlocks_lastDeadlock = asList(threadInfo);
}

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: 499 / 541
Version history: 11 change(s)
Referenced in: [show references]