It’s possible to detect deadlocks programmatically in Java. This can be done via the class ThreadMXBean, by using its method findDeadlockedThreads: ThreadMXBean bean = ManagementFactory.getThreadMXBean(); long[] threadIds = bean.findDeadlockedThreads(); // Returns null if no threads are deadlocked At this point we can iterate on the threadIds and print some information about each deadalocked thread: if (threadIds != null) { logger.error("Threads in deadlocks: {}", Arrays.toString(threadIds)...