本文整理汇总了Java中sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer方法的典型用法代码示例。如果您正苦于以下问题:Java ConnectorBootstrap.startRemoteConnectorServer方法的具体用法?Java ConnectorBootstrap.startRemoteConnectorServer怎么用?Java ConnectorBootstrap.startRemoteConnectorServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.management.jmxremote.ConnectorBootstrap
的用法示例。
在下文中一共展示了ConnectorBootstrap.startRemoteConnectorServer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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());
}
}
示例4: 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);
}
}