Code example for ConnectorServerFactoryBean

0
/** 
 * 扩展实现spring的jmx connector 
 *  
 * @author jianghang 2012-7-30 下午12:50:05 
 */ 
public class JmxConnectorServerFactoryBean extends ConnectorServerFactoryBean {
 
    private String              SERVER_URL           = "service:jmx:rmi://127.0.0.1:{0}/jndi/rmi://127.0.0.1:{0}/mbean";
    private boolean             alwaysCreateRegistry = false;
    private ConfigClientService configClientService;
 
    public void afterPropertiesSet() throws JMException, IOException {
        Node node = configClientService.currentNode();
        int port = node.getPort().intValue() + 1;
        Integer mbeanPort = node.getParameters().getMbeanPort();
        if (mbeanPort != null && mbeanPort != 0) {// 做个兼容处理,<=4.2.2版本没有mbeanPort设置
            port = mbeanPort;
        } 
 
        String serviceUrl = MessageFormat.format(SERVER_URL, String.valueOf(port));
Connect your IDE to all the code out there  Get Codota for Java