public static String createJMXUrl(String hostName, int port) { if (isHostNameOfIpv6AndNeedsSquareBrackets(hostName)) hostName = "[" + hostName + "]"; return createJMXUrl(hostName + ":" + port); }
public static String createJMXUrl(String jndiURL) { jndiURL = convertJndiURLtoIpV6Compliant(jndiURL); return "service:jmx:rmi:///jndi/rmi://" + jndiURL + "/jmxrmi"; }
/** * create MBean server connection according to certain JNDI URL * * @return MBean server connection */ public static MBeanServerConnection createMBeanServerConnection(String jndiURL) throws Exception { JMXServiceURL url = new JMXServiceURL(JMXUtilities.createJMXUrl(jndiURL)); JMXConnector jmxc = JMXConnectorFactory.connect(url, null); return jmxc.getMBeanServerConnection(); } }
private static String convertJndiURLtoIpV6Compliant(String jndiURL) { if (jndiURL.indexOf(":") == jndiURL.lastIndexOf(":")) return jndiURL; String hostName = jndiURL.substring(0, jndiURL.lastIndexOf(":")); if (!isHostNameOfIpv6AndNeedsSquareBrackets(hostName)) return jndiURL; String port = jndiURL.substring(jndiURL.lastIndexOf(":") + 1); return "[" + hostName + "]:" + port; } }
protected List<Entry> loadInitialLookupAttributes() { List<Entry> result = new ArrayList<Entry>(); result.add(new net.jini.lookup.entry.Name("Lookup")); /* Get the JMX Service URL */ JMXConnection jmxConnection = JMXUtilities.createJMXConnectionAttribute("LUS"); if (jmxConnection != null) { result.add(jmxConnection); } if (DynamicLookupLocatorDiscovery.dynamicLocatorsEnabled()) { result.add(DynamicLookupLocatorDiscovery.DYNAMIC_LOCATORS_ENABLED_LOOKUP_ATTRIBUTE); } return result; }
containerName, LOOKUP_JNDI_URL_PROP, LOOKUP_JNDI_URL_DEFAULT); jmxServiceURL = JMXUtilities.createJMXUrl(jndiUrl); Map env = System.getProperties(); jmxConn = JMXConnectorServerFactory.newJMXConnectorServer(
String jmxServiceURL = JMXUtilities.createJMXUrl(_rmiHostAndPort); System.setProperty(CommonSystemProperties.JMX_SERVICE_URL, jmxServiceURL); if (_logger.isLoggable(Level.CONFIG))
final String jmxServiceURL = JMXUtilities.createJMXUrl(hostAddress, registryPort); final String jmxServicePublicURL = JMXUtilities.createJMXUrl(publicHostAddress, registryPort); if (mbs != null) { String publicHostAddress= SystemInfo.singleton().network().getPublicHostId(); final String jmxServiceURL = JMXUtilities.createJMXUrl(hostAddress, jmxRemotePort); final String jmxServicePublicURL = JMXUtilities.createJMXUrl(publicHostAddress, registryPort);