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


Java MonitoredHost.setInterval方法代码示例

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


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

示例1: main

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException,
        MonitorException, URISyntaxException {
    LingeredApp app = null;
    try {
        List<String> vmArgs = new ArrayList<String>();
        vmArgs.add("-XX:+UsePerfData");
        vmArgs.addAll(Utils.getVmOptions());
        app = LingeredApp.startApp(vmArgs);

        MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
        String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
        VmIdentifier vmId = new VmIdentifier(uriString);
        MonitoredVm vm = localHost.getMonitoredVm(vmId);
        System.out.println("Monitored vm command line: " + MonitoredVmUtil.commandLine(vm));

        vm.setInterval(INTERVAL);
        localHost.setInterval(INTERVAL);

        Asserts.assertEquals(vm.getInterval(), INTERVAL, "Monitored vm interval should be equal the test value");
        Asserts.assertEquals(localHost.getInterval(), INTERVAL, "Monitored host interval should be equal the test value");
    } finally {
        LingeredApp.stopApp(app);
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:TestPollingInterval.java

示例2: main

import sun.jvmstat.monitor.MonitoredHost; //导入方法依赖的package包/类
public static void main(String[] args) {
    int vmInterval;
    int hostInterval;

    try {
        MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
        Set vms = localHost.activeVms();
        Integer vmInt =  (Integer) vms.iterator().next();
        String uriString = "//" + vmInt + "?mode=r"; // NOI18N
        VmIdentifier vmId = new VmIdentifier(uriString);
        MonitoredVm vm = localHost.getMonitoredVm(vmId);

        vm.setInterval(INTERVAL);
        localHost.setInterval(INTERVAL);
        vmInterval = vm.getInterval();
        hostInterval = localHost.getInterval();
    } catch (Exception ex) {
        throw new Error ("Test failed",ex);
    }
    System.out.println("VM "+vmInterval);
    if (vmInterval != INTERVAL) {
        throw new Error("Test failed");
    }
    System.out.println("Host "+hostInterval);
    if (hostInterval != INTERVAL) {
        throw new Error("Test failed");
    }
}
 
开发者ID:frohoff,项目名称:jdk8u-dev-jdk,代码行数:29,代码来源:CR6672135.java


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