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


Java MonitoredHost.detach方法代码示例

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


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

示例1: getMainClass

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
private static String getMainClass(VirtualMachineDescriptor vmd)
        throws URISyntaxException, MonitorException {
    try {
        String mainClass = null;
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
        return mainClass;
    } catch(NullPointerException e) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return null;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:JCmd.java

示例2: check

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
    String mainClass = null;
    try {
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
    } catch (NullPointerException npe) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return false;
    } catch (MonitorException | URISyntaxException e) {
        return false;
    }

    if (excludeClass != null && mainClass.equals(excludeClass)) {
        return false;
    }

    if (partialMatch != null && mainClass.indexOf(partialMatch) == -1) {
        return false;
    }

    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ProcessArgumentMatcher.java

示例3: check

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
private boolean check(VirtualMachineDescriptor vmd) {
    String mainClass = null;
    try {
        VmIdentifier vmId = new VmIdentifier(vmd.id());
        MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
        MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
        mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
        monitoredHost.detach(monitoredVm);
    } catch (NullPointerException npe) {
        // There is a potential race, where a running java app is being
        // queried, unfortunately the java app has shutdown after this
        // method is started but before getMonitoredVM is called.
        // If this is the case, then the /tmp/hsperfdata_xxx/pid file
        // will have disappeared and we will get a NullPointerException.
        // Handle this gracefully....
        return false;
    } catch (MonitorException | URISyntaxException e) {
        if (e.getMessage() != null) {
            System.err.println(e.getMessage());
        } else {
            Throwable cause = e.getCause();
            if ((cause != null) && (cause.getMessage() != null)) {
                System.err.println(cause.getMessage());
            } else {
                e.printStackTrace();
            }
        }
        return false;
    }

    if (mainClass.equals(excludeCls)) {
        return false;
    }

    if (matchAll || mainClass.indexOf(matchClass) != -1) {
        return true;
    }

    return false;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:41,代码来源:ProcessArgumentMatcher.java

示例4: logNames

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
static void logNames() throws MonitorException {
	VmIdentifier vmId = arguments.vmId();
	int interval = arguments.sampleInterval();
	MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
	MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, interval);
	JStatLogger logger = new JStatLogger(monitoredVm);
	logger.printNames(arguments.counterNames(), arguments.comparator(), arguments.showUnsupported(), System.out);
	monitoredHost.detach(monitoredVm);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:10,代码来源:Jstat.java

示例5: logSnapShot

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
static void logSnapShot() throws MonitorException {
	VmIdentifier vmId = arguments.vmId();
	int interval = arguments.sampleInterval();
	MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
	MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, interval);
	JStatLogger logger = new JStatLogger(monitoredVm);
	logger.printSnapShot(arguments.counterNames(), arguments.comparator(), arguments.isVerbose(), arguments.showUnsupported(),
			System.out);
	monitoredHost.detach(monitoredVm);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:11,代码来源:Jstat.java


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