Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.management.MonitorInfo;
import java.lang.management.ThreadInfo;

public class Main {
    /** Add more specific locking details. */
    private static void addMonitorInfo(ThreadInfo info, StringBuilder sb, int stackDepth) {
        MonitorInfo[] monitorInfos = info.getLockedMonitors();
        for (int i = 0; i < monitorInfos.length; i++) {
            MonitorInfo mi = monitorInfos[i];
            int depth = mi.getLockedStackDepth();
            if (depth == stackDepth) {
                sb.append("\t-  locked " + mi + "\n");
            }
        }
    }
}