Java 8 MonitorInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MonitorInfo class.

This code example shows how to use the following methods:getLockedStackDepth
            ThreadInfo info) {
        final MonitorInfo[] lockedMonitors = info.getLockedMonitors();
        Arrays.sort(lockedMonitors, new Comparator<MonitorInfo>() {
            @Override 
            public int compare(MonitorInfo a, MonitorInfo b) {
                return b.getLockedStackDepth() - a.getLockedStackDepth();
            } 
        }); 
        for (MonitorInfo mi : lockedMonitors) {
            String lockName = getObjectName(mi);
            if (lockName.equals("sun.misc.Launcher$AppClassLoader")) {
                // ignore, it shows up everywhere 
                continue; 
            } 
            // Ignore locks which are locked multiple times in 
            // succession - Java locks are recursive. 
            if (!lockOrder.contains(lockName)) {
                lockOrder.add(lockName);
            } 
        } 
4
CodeRank
See Code Examples for Java 8 MonitorInfo Methods: