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


Java ConnectorBootstrap类代码示例

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


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

示例1: startLocalManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private static synchronized void startLocalManagementAgent() {
    Properties agentProps = VMSupport.getAgentProperties();

    // start local connector if not started
    if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) {
        JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer();
        String address = cs.getAddress().toString();
        // Add the local connector address to the agent properties
        agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address);

        try {
            // export the address to the instrumentation buffer
            ConnectorAddressLink.export(address);
        } catch (Exception x) {
            // Connector server started but unable to export address
            // to instrumentation buffer - non-fatal error.
            warning(EXPORT_ADDRESS_FAILED, x.getMessage());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:Agent.java

示例2: startLocalManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private static synchronized void startLocalManagementAgent(){
    Properties agentProps = VMSupport.getAgentProperties();

    // start local connector if not started
    if (agentProps.get(LOCAL_CONNECTOR_ADDRESS_PROP) == null) {
        JMXConnectorServer cs = ConnectorBootstrap.startLocalConnectorServer();
        String address = cs.getAddress().toString();
        // Add the local connector address to the agent properties
        agentProps.put(LOCAL_CONNECTOR_ADDRESS_PROP, address);

        try {
            // export the address to the instrumentation buffer
            ConnectorAddressLink.export(address);
        } catch (Exception x) {
            // Connector server started but unable to export address
            // to instrumentation buffer - non-fatal error.
            warning(EXPORT_ADDRESS_FAILED, x.getMessage());
        }
    }
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:21,代码来源:Agent.java

示例3: stopRemoteManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private static synchronized void stopRemoteManagementAgent() throws Exception {

        JdpController.stopDiscoveryService();

        if (jmxServer != null) {
            ConnectorBootstrap.unexportRegistry();

            // Attempt to stop already stopped agent
            // Don't cause any errors.
            jmxServer.stop();
            jmxServer = null;
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Agent.java

示例4: initialize

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
/**
 * Initialize this <code>LoginModule</code>.
 *
 * @param subject the <code>Subject</code> to be authenticated.
 * @param callbackHandler a <code>CallbackHandler</code> to acquire the
 *                  user's name and password.
 * @param sharedState shared <code>LoginModule</code> state.
 * @param options options specified in the login
 *                  <code>Configuration</code> for this particular
 *                  <code>LoginModule</code>.
 */
public void initialize(Subject subject, CallbackHandler callbackHandler,
                       Map<String,?> sharedState,
                       Map<String,?> options)
{

    this.subject = subject;
    this.callbackHandler = callbackHandler;
    this.sharedState = Util.cast(sharedState);
    this.options = options;

    // initialize any configured options
    tryFirstPass =
            "true".equalsIgnoreCase((String)options.get("tryFirstPass"));
    useFirstPass =
            "true".equalsIgnoreCase((String)options.get("useFirstPass"));
    storePass =
            "true".equalsIgnoreCase((String)options.get("storePass"));
    clearPass =
            "true".equalsIgnoreCase((String)options.get("clearPass"));

    passwordFile = (String)options.get("passwordFile");
    passwordFileDisplayName = passwordFile;
    userSuppliedPasswordFile = true;

    // set the location of the password file
    if (passwordFile == null) {
        passwordFile = DEFAULT_PASSWORD_FILE_NAME;
        userSuppliedPasswordFile = false;
        try {
            System.getProperty("java.home");
            hasJavaHomePermission = true;
            passwordFileDisplayName = passwordFile;
        } catch (SecurityException e) {
            hasJavaHomePermission = false;
            passwordFileDisplayName =
                    ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:FileLoginModule.java

示例5: addConfigProperties

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private void addConfigProperties() {
    appendConfigPropsHeader();

    Properties remoteProps = configProps != null ?
                                configProps : getManagementProperties();
    Map<Object, Object> props = new HashMap<>(DEFAULT_PROPS);

    if (remoteProps == null) {
        // local connector only
        String loc_only = System.getProperty(
            ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY
        );

        if (loc_only != null &&
            !ConnectorBootstrap.DefaultValues.USE_LOCAL_ONLY.equals(loc_only)) {
            props.put(
                ConnectorBootstrap.PropertyNames.USE_LOCAL_ONLY,
                loc_only
            );
        }
    } else {
        props.putAll(remoteProps);
    }

    props.entrySet().stream()
        .filter(preprocess(Map.Entry::getKey, StatusCollector::isManagementProp))
        .forEach(this::addConfigProp);

    appendConfigPropsFooter();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:Agent.java

示例6: stopRemoteManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private static synchronized void stopRemoteManagementAgent() throws Exception {

        JdpController.stopDiscoveryService();

        if (jmxServer != null) {
            ConnectorBootstrap.unexportRegistry();
            ConnectorAddressLink.unexportRemote();

            // Attempt to stop already stopped agent
            // Don't cause any errors.
            jmxServer.stop();
            jmxServer = null;
            configProps = null;
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:Agent.java

示例7: stopRemoteManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的package包/类
private static synchronized void stopRemoteManagementAgent() throws Exception {

        JdpController.stopDiscoveryService();
        if (jmxServer != null) {
            ConnectorBootstrap.unexportRegistry();

            // Attempt to stop already stopped agent
            // Don't cause any errors.
            jmxServer.stop();
            jmxServer = null;
        }
    }
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:13,代码来源:Agent.java

示例8: startRemoteManagementAgent

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

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

    // Load the management properties from the config file
    // if config file is not specified readConfiguration implicitly
    // reads <java.home>/lib/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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:Agent.java

示例9: startRemoteManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的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

示例10: startRemoteManagementAgent

import sun.management.jmxremote.ConnectorBootstrap; //导入依赖的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.jmxremote.ConnectorBootstrap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。