本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}