Example usage for org.springframework.jmx.support ConnectorServerFactoryBean setObjectName

List of usage examples for org.springframework.jmx.support ConnectorServerFactoryBean setObjectName

Introduction

In this page you can find the example usage for org.springframework.jmx.support ConnectorServerFactoryBean setObjectName.

Prototype

public void setObjectName(Object objectName) throws MalformedObjectNameException 

Source Link

Document

Set the ObjectName used to register the JMXConnectorServer itself with the MBeanServer , as ObjectName instance or as String .

Usage

From source file:com.newlandframework.rpc.jmx.ThreadPoolMonitorProvider.java

@Bean
@DependsOn("registry")
public ConnectorServerFactoryBean connectorServer() throws MalformedObjectNameException {
    MessageRecvExecutor ref = MessageRecvExecutor.getInstance();
    String ipAddr = StringUtils.isNotEmpty(ref.getServerAddress())
            ? StringUtils.substringBeforeLast(ref.getServerAddress(), DELIMITER)
            : "localhost";
    url = "service:jmx:rmi://" + ipAddr + "/jndi/rmi://" + ipAddr + ":1099/nettyrpcstatus";
    System.out.println("NettyRPC JMX MonitorURL : [" + url + "]");
    ConnectorServerFactoryBean connectorServerFactoryBean = new ConnectorServerFactoryBean();
    connectorServerFactoryBean.setObjectName("connector:name=rmi");
    connectorServerFactoryBean.setServiceUrl(url);
    return connectorServerFactoryBean;
}