protected JMXServiceURL getServiceUrl(final int portOne, int portTwo) {
        final String jmxHost;
        if (this.host == null) {
            final InetAddress inetHost;
            try {
                inetHost = InetAddress.getLocalHost();
            } catch (UnknownHostException uhe) {
                throw new IllegalStateException("Cannot resolve localhost InetAddress.", uhe);
            }

            jmxHost = inetHost.getHostName();
        } else {
            jmxHost = this.host;
        }

        final String jmxUrl =
                "service:jmx:rmi://"
                        + jmxHost
                        + ":"
                        + portTwo
                        + "/jndi/rmi://"
                        + jmxHost
                        + ":"
                        + portOne
                        + "/server";

        final JMXServiceURL jmxServiceUrl;
        try {
            jmxServiceUrl = new JMXServiceURL(jmxUrl);
        } catch (MalformedURLException mue) {
            throw new IllegalStateException(
                    "Failed to create JMXServiceURL for url String '" + jmxUrl + "'", mue);
        }

        if (this.logger.isDebugEnabled()) {
            this.logger.debug(
                    "Generated JMXServiceURL='" + jmxServiceUrl + "' from String " + jmxUrl + "'.");
        }

        return jmxServiceUrl;
    }
protected JMXServiceURL getServiceUrl ( final int portOne , int portTwo ) { final String jmxHost ; if ( this . host == null ) { final InetAddress inetHost ; try { inetHost = InetAddress . getLocalHost ( ) ; } catch ( UnknownHostException uhe ) { throw new IllegalStateException ( "Cannot resolve localhost InetAddress." , uhe ) ; } jmxHost = inetHost . getHostName ( ) ; } else { jmxHost = this . host ; } final String jmxUrl = "service:jmx:rmi://" + jmxHost + ":" + portTwo + "/jndi/rmi://" + jmxHost + ":" + portOne + "/server" ; final JMXServiceURL jmxServiceUrl ; try { jmxServiceUrl = new JMXServiceURL ( jmxUrl ) ; } catch ( MalformedURLException mue ) { throw new IllegalStateException ( "Failed to create JMXServiceURL for url String '" + jmxUrl + "'" , mue ) ; } if ( this . logger . isDebugEnabled ( ) ) { this . logger . debug ( "Generated JMXServiceURL='" + jmxServiceUrl + "' from String " + jmxUrl + "'." ) ; } return jmxServiceUrl ; }
Generates the JMXServiceURL for the two specified ports.

@return A JMXServiceURL for this host using the two specified ports.
@throws IllegalStateException If localhost cannot be resolved or if the JMXServiceURL is
malformed.