Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 711 Bytes

File metadata and controls

18 lines (16 loc) · 711 Bytes

Deadlock -- A runtime deadlocks detector.

DESCRIPTION

This small utility use JMX (threadsMXbean.findMonitorDeadlockedThreads()) to find deadlocks while program is running. Sample Usage:

 new DeadlockDetector(1, TimeUnit.SECONDS,
            new DeadlockListener() {
                @Override
                public void onDeadlock(List<ThreadInfo> deadLockThreads) {
                    logger.fatal("Found deadlock:" + deadLockThreads);
                    System.exit(-1);
                }
            });
    Deadlock.create(Executors.newCachedThreadPool());
    Thread.sleep(Integer.MAX_VALUE);

See examples directory.