当前位置: 首页>>代码示例>>Java>>正文


Java JPDAThread.getOwnedMonitors方法代码示例

本文整理汇总了Java中org.netbeans.api.debugger.jpda.JPDAThread.getOwnedMonitors方法的典型用法代码示例。如果您正苦于以下问题:Java JPDAThread.getOwnedMonitors方法的具体用法?Java JPDAThread.getOwnedMonitors怎么用?Java JPDAThread.getOwnedMonitors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.debugger.jpda.JPDAThread的用法示例。


在下文中一共展示了JPDAThread.getOwnedMonitors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildGraph

import org.netbeans.api.debugger.jpda.JPDAThread; //导入方法依赖的package包/类
private void buildGraph(Collection<JPDAThread> threads) {
    monitorToNode = new HashMap<Long, Node>();
    for (JPDAThread thread : threads) {
        if (thread.getState() == JPDAThread.STATE_ZOMBIE) {
            continue;
        }
        ObjectVariable contendedMonitor = thread.getContendedMonitor();
        ObjectVariable[] ownedMonitors = thread.getOwnedMonitors();
        if (contendedMonitor != null && (((JDIVariable) contendedMonitor).getJDIValue() instanceof ThreadReference)) {
            ownedMonitors = checkForThreadJoin(thread, ownedMonitors);
        }
        if (contendedMonitor == null || ownedMonitors.length == 0) {
            continue;
        } // if
        Node contNode = monitorToNode.get(contendedMonitor.getUniqueID());
        if (contNode == null) {
            contNode = new Node(null, contendedMonitor);
            monitorToNode.put(contendedMonitor.getUniqueID(), contNode);
        }
        for (int x = 0; x < ownedMonitors.length; x++) {
            Node node = monitorToNode.get(ownedMonitors[x].getUniqueID());
            if (node == null) {
                node = new Node(thread, ownedMonitors[x]);
                monitorToNode.put(ownedMonitors[x].getUniqueID(), node);
            } else if (node.thread == null) {
                node.thread = thread;
            } else {
                continue;
            }
            node.setOutgoing(contNode);
            contNode.addIncomming(node);
        } // for
    } // for
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:DeadlockDetectorImpl.java

示例2: getContendedMonitorAndOwner

import org.netbeans.api.debugger.jpda.JPDAThread; //导入方法依赖的package包/类
@Override
public MonitorInfo getContendedMonitorAndOwner() {
    ObjectVariable monitor = getContendedMonitor();
    if (monitor == null) return null;
    // Search for the owner:
    MonitorInfo monitorInfo = null;
    JPDAThread thread = null;
    List<JPDAThread> threads = debugger.getThreadsCollector().getAllThreads();
    for (JPDAThread t : threads) {
        if (this == t) continue;
        ObjectVariable[] ms = t.getOwnedMonitors();
        for (ObjectVariable m : ms) {
            if (monitor.equals(m)) {
                thread = t;
                List<MonitorInfo> mf = t.getOwnedMonitorsAndFrames();
                for (MonitorInfo mi : mf) {
                    if (monitor.equals(mi.getMonitor())) {
                        monitorInfo = mi;
                        break;
                    }
                }
                break;
            }
        }
        if (thread != null) {
            break;
        }
    }
    if (monitorInfo != null) {
        return monitorInfo;
    }
    return new MonitorInfoImpl(thread, null, monitor);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:JPDAThreadImpl.java


注:本文中的org.netbeans.api.debugger.jpda.JPDAThread.getOwnedMonitors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。