本文整理汇总了Java中org.springframework.jmx.support.JmxUtils.locateMBeanServer方法的典型用法代码示例。如果您正苦于以下问题:Java JmxUtils.locateMBeanServer方法的具体用法?Java JmxUtils.locateMBeanServer怎么用?Java JmxUtils.locateMBeanServer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jmx.support.JmxUtils
的用法示例。
在下文中一共展示了JmxUtils.locateMBeanServer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
/**
* Connects to the remote {@code MBeanServer} using the configured {@code JMXServiceURL}:
* to the specified JMX service, or to a local MBeanServer if no service URL specified.
* @param serviceUrl the JMX service URL to connect to (may be {@code null})
* @param environment the JMX environment for the connector (may be {@code null})
* @param agentId the local JMX MBeanServer's agent id (may be {@code null})
*/
public MBeanServerConnection connect(JMXServiceURL serviceUrl, Map<String, ?> environment, String agentId)
throws MBeanServerNotFoundException {
if (serviceUrl != null) {
if (logger.isDebugEnabled()) {
logger.debug("Connecting to remote MBeanServer at URL [" + serviceUrl + "]");
}
try {
this.connector = JMXConnectorFactory.connect(serviceUrl, environment);
return this.connector.getMBeanServerConnection();
}
catch (IOException ex) {
throw new MBeanServerNotFoundException("Could not connect to remote MBeanServer [" + serviceUrl + "]", ex);
}
}
else {
logger.debug("Attempting to locate local MBeanServer");
return JmxUtils.locateMBeanServer(agentId);
}
}
示例2: afterPropertiesSet
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
/**
* Kick off bean registration automatically when deployed in an
* {@code ApplicationContext}.
* @see #registerBeans()
*/
@Override
public void afterPropertiesSet() {
// If no server was provided then try to find one. This is useful in an environment
// where there is already an MBeanServer loaded.
if (this.server == null) {
this.server = JmxUtils.locateMBeanServer();
}
try {
logger.info("Registering beans for JMX exposure on startup");
registerBeans();
registerNotificationListeners();
}
catch (RuntimeException ex) {
// Unregister beans already registered by this exporter.
unregisterNotificationListeners();
unregisterBeans();
throw ex;
}
}
示例3: afterPropertiesSet
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
/**
* Start bean registration automatically when deployed in an
* {@code ApplicationContext}.
* @see #registerBeans()
*/
@Override
public void afterPropertiesSet() {
// If no server was provided then try to find one. This is useful in an environment
// such as JDK 1.5, Tomcat or JBoss where there is already an MBeanServer loaded.
if (this.server == null) {
this.server = JmxUtils.locateMBeanServer();
}
try {
logger.info("Registering beans for JMX exposure on startup");
registerBeans();
registerNotificationListeners();
}
catch (RuntimeException ex) {
// Unregister beans already registered by this exporter.
unregisterNotificationListeners();
unregisterBeans();
throw ex;
}
}
示例4: afterPropertiesSet
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
/**
* Kick off bean registration automatically when deployed in an
* {@code ApplicationContext}.
* @see #registerBeans()
*/
public void afterPropertiesSet() {
// If no server was provided then try to find one. This is useful in an environment
// where there is already an MBeanServer loaded.
if (this.server == null) {
this.server = JmxUtils.locateMBeanServer();
}
try {
logger.info("Registering beans for JMX exposure on startup");
registerBeans();
registerNotificationListeners();
}
catch (RuntimeException ex) {
// Unregister beans already registered by this exporter.
unregisterNotificationListeners();
unregisterBeans();
throw ex;
}
}
示例5: afterPropertiesSet
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() {
// If no server was provided then try to find one. This is useful in an environment
// where there is already an MBeanServer loaded.
if (this.server == null) {
this.server = JmxUtils.locateMBeanServer();
}
}
示例6: MonitoredMBeanAttributeFactory
import org.springframework.jmx.support.JmxUtils; //导入方法依赖的package包/类
public MonitoredMBeanAttributeFactory(String name, String description,
String mBeanName, String attributeName) {
this(name, description, mBeanName, attributeName, null,
JmxUtils.locateMBeanServer());
}