src/java.management/share/classes/sun/management/Agent.java

Print this page

        

*** 208,217 **** --- 208,219 ---- startDiscoveryService(configProps); } else { throw new AgentConfigurationError(INVALID_JMXREMOTE_PORT, "No port specified"); } + } catch (JdpException e) { + error(e); } catch (AgentConfigurationError err) { error(err.getError(), err.getParams()); } }
*** 271,281 **** error(e); } } private static void startDiscoveryService(Properties props) ! throws IOException { // Start discovery service if requested String discoveryPort = props.getProperty("com.sun.management.jdp.port"); String discoveryAddress = props.getProperty("com.sun.management.jdp.address"); String discoveryShouldStart = props.getProperty("com.sun.management.jmxremote.autodiscovery"); --- 273,283 ---- error(e); } } private static void startDiscoveryService(Properties props) ! throws IOException, JdpException { // Start discovery service if requested String discoveryPort = props.getProperty("com.sun.management.jdp.port"); String discoveryAddress = props.getProperty("com.sun.management.jdp.address"); String discoveryShouldStart = props.getProperty("com.sun.management.jmxremote.autodiscovery");
*** 289,318 **** } else{ try{ shouldStart = Boolean.parseBoolean(discoveryShouldStart); } catch (NumberFormatException e) { ! throw new AgentConfigurationError("Couldn't parse autodiscovery argument"); } } if (shouldStart) { // port and address are required arguments and have no default values InetAddress address; try { address = (discoveryAddress == null) ? InetAddress.getByName(JDP_DEFAULT_ADDRESS) : InetAddress.getByName(discoveryAddress); } catch (UnknownHostException e) { ! throw new AgentConfigurationError("Unable to broadcast to requested address", e); } int port = JDP_DEFAULT_PORT; if (discoveryPort != null) { try { port = Integer.parseInt(discoveryPort); } catch (NumberFormatException e) { ! throw new AgentConfigurationError("Couldn't parse JDP port argument"); } } // Rebuilding service URL to broadcast it String jmxremotePort = props.getProperty(JMXREMOTE_PORT); --- 291,320 ---- } else{ try{ shouldStart = Boolean.parseBoolean(discoveryShouldStart); } catch (NumberFormatException e) { ! throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse autodiscovery argument"); } } if (shouldStart) { // port and address are required arguments and have no default values InetAddress address; try { address = (discoveryAddress == null) ? InetAddress.getByName(JDP_DEFAULT_ADDRESS) : InetAddress.getByName(discoveryAddress); } catch (UnknownHostException e) { ! throw new AgentConfigurationError(AGENT_EXCEPTION, e, "Unable to broadcast to requested address"); } int port = JDP_DEFAULT_PORT; if (discoveryPort != null) { try { port = Integer.parseInt(discoveryPort); } catch (NumberFormatException e) { ! throw new AgentConfigurationError(AGENT_EXCEPTION, "Couldn't parse JDP port argument"); } } // Rebuilding service URL to broadcast it String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
*** 328,344 **** : String.format( "service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", hostname, jmxremotePort); String instanceName = props.getProperty("com.sun.management.jdp.name"); - try{ JdpController.startDiscoveryService(address, port, instanceName, jmxUrlStr); } - catch(JdpException e){ - throw new AgentConfigurationError("Couldn't start JDP service", e); - } - } } public static Properties loadManagementProperties() { Properties props = new Properties(); --- 330,341 ----