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


Java JdpException类代码示例

本文整理汇总了Java中sun.management.jdp.JdpException的典型用法代码示例。如果您正苦于以下问题:Java JdpException类的具体用法?Java JdpException怎么用?Java JdpException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkFieldPresence

import sun.management.jdp.JdpException; //导入依赖的package包/类
private void checkFieldPresence(JdpJmxPacket p)
        throws IOException, JdpException {

    byte[] b = p.getPacketData();

    JdpPacketReader reader = new JdpPacketReader(b);
    Map<String, String> pMap = reader.getDiscoveryDataAsMap();

    get(pMap, JdpJmxPacket.UUID_KEY);
    get(pMap, JdpJmxPacket.MAIN_CLASS_KEY);
    get(pMap, JdpJmxPacket.JMX_SERVICE_URL_KEY);
    // get(pMap, JdpJmxPacket.INSTANCE_NAME_KEY);
    get(pMap, JdpJmxPacket.PROCESS_ID_KEY);
    get(pMap, JdpJmxPacket.BROADCAST_INTERVAL_KEY);
    get(pMap, JdpJmxPacket.RMI_HOSTNAME_KEY);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:JdpClient.java

示例2: compaireJdpPacketEx

import sun.management.jdp.JdpException; //导入依赖的package包/类
public static void compaireJdpPacketEx(JdpJmxPacket p1, JdpJmxPacket p2)
        throws JdpException {

    if (!Objects.equals(p1, p1)) {
        throw new JdpException("Packet mismatch error");
    }

    if (!Objects.equals(p1.getMainClass(), p2.getMainClass())) {
        throw new JdpException("Packet mismatch error (main class)");
    }

    if (!Objects.equals(p1.getInstanceName(), p2.getInstanceName())) {
        throw new JdpException("Packet mismatch error (instance name)");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:JdpDoSomething.java

示例3: get

import sun.management.jdp.JdpException; //导入依赖的package包/类
private void get(Map<?, ?> map, String key)
        throws JdpException {

    if (map.get(key) == null) {
        throw new JdpException("Test failed, packet field " + key + " missed");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:JdpClient.java

示例4: startFakeDiscoveryService

import sun.management.jdp.JdpException; //导入依赖的package包/类
public static void startFakeDiscoveryService()
        throws IOException, JdpException {

    String discoveryPort = System.getProperty("com.sun.management.jdp.port");
    String discoveryAddress = System.getProperty("com.sun.management.jdp.address");
    InetAddress address = InetAddress.getByName(discoveryAddress);
    int port = Integer.parseInt(discoveryPort);
    JdpController.startDiscoveryService(address, port, "FakeDiscovery", "fake://unit-test");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:JdpUnitTest.java

示例5: compaireJdpPacketEx

import sun.management.jdp.JdpException; //导入依赖的package包/类
public static void compaireJdpPacketEx(JdpJmxPacket p1, JdpJmxPacket p2)
throws JdpException {

    if (!Objects.equals(p1, p1)) {
        throw new JdpException("Packet mismatch error");
    }

    if (!Objects.equals(p1.getMainClass(), p2.getMainClass())) {
        throw new JdpException("Packet mismatch error (main class)");
    }

    if (!Objects.equals(p1.getInstanceName(), p2.getInstanceName())) {
        throw new JdpException("Packet mismatch error (instance name)");
    }
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:16,代码来源:JdpDoSomething.java

示例6: startRemoteManagementAgent

import sun.management.jdp.JdpException; //导入依赖的package包/类
private static synchronized void startRemoteManagementAgent(String args) throws Exception {
    if (jmxServer != null) {
        throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));
    }

    try {
        Properties argProps = parseString(args);
        configProps = new Properties();

        // Load the management properties from the config file
        // if config file is not specified readConfiguration implicitly
        // reads <java.home>/conf/management/management.properties

        String fname = System.getProperty(CONFIG_FILE);
        readConfiguration(fname, configProps);

        // management properties can be overridden by system properties
        // which take precedence
        Properties sysProps = System.getProperties();
        synchronized (sysProps) {
            configProps.putAll(sysProps);
        }

        // if user specifies config file into command line for either
        // jcmd utilities or attach command it overrides properties set in
        // command line at the time of VM start
        String fnameUser = argProps.getProperty(CONFIG_FILE);
        if (fnameUser != null) {
            readConfiguration(fnameUser, configProps);
        }

        // arguments specified in command line of jcmd utilities
        // override both system properties and one set by config file
        // specified in jcmd command line
        configProps.putAll(argProps);

        // jcmd doesn't allow to change ThreadContentionMonitoring, but user
        // can specify this property inside config file, so enable optional
        // monitoring functionality if this property is set
        final String enableThreadContentionMonitoring =
                configProps.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);

        if (enableThreadContentionMonitoring != null) {
            ManagementFactory.getThreadMXBean().
                    setThreadContentionMonitoringEnabled(true);
        }

        String jmxremotePort = configProps.getProperty(JMXREMOTE_PORT);
        if (jmxremotePort != null) {
            jmxServer = ConnectorBootstrap.
                    startRemoteConnectorServer(jmxremotePort, configProps);

            startDiscoveryService(configProps);
        } else {
            throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified");
        }
    } catch (JdpException e) {
        error(e);
    } catch (AgentConfigurationError err) {
        error(err);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:Agent.java

示例7: startRemoteManagementAgent

import sun.management.jdp.JdpException; //导入依赖的package包/类
private static synchronized void startRemoteManagementAgent(String args) throws Exception {
    if (jmxServer != null) {
        throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));
    }

    try {
        Properties argProps = parseString(args);
        configProps = new Properties();

        // Load the management properties from the config file
        // if config file is not specified readConfiguration implicitly
        // reads <java.home>/conf/management/management.properties

        String fname = System.getProperty(CONFIG_FILE);
        readConfiguration(fname, configProps);

        // management properties can be overridden by system properties
        // which take precedence
        Properties sysProps = System.getProperties();
        synchronized (sysProps) {
            configProps.putAll(sysProps);
        }

        // if user specifies config file into command line for either
        // jcmd utilities or attach command it overrides properties set in
        // command line at the time of VM start
        String fnameUser = argProps.getProperty(CONFIG_FILE);
        if (fnameUser != null) {
            readConfiguration(fnameUser, configProps);
        }

        // arguments specified in command line of jcmd utilities
        // override both system properties and one set by config file
        // specified in jcmd command line
        configProps.putAll(argProps);

        // jcmd doesn't allow to change ThreadContentionMonitoring, but user
        // can specify this property inside config file, so enable optional
        // monitoring functionality if this property is set
        final String enableThreadContentionMonitoring =
                configProps.getProperty(ENABLE_THREAD_CONTENTION_MONITORING);

        if (enableThreadContentionMonitoring != null) {
            ManagementFactory.getThreadMXBean().
                    setThreadContentionMonitoringEnabled(true);
        }

        String jmxremotePort = configProps.getProperty(JMXREMOTE_PORT);
        if (jmxremotePort != null) {
            jmxServer = ConnectorBootstrap.
                    startRemoteConnectorServer(jmxremotePort, configProps);

            startDiscoveryService(configProps);
        } else {
            throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified");
        }
    } catch (JdpException e) {
        error(e);
    } catch (AgentConfigurationError err) {
        error(err.getError(), err.getParams());
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:63,代码来源:Agent.java


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