address = vm.startLocalManagementAgent();
@Override protected String getJmxUrl() { String address = null; try { address = withTimeout(() -> vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS)); } catch (Exception e) { //ignore } if (address==null) { try { address = withTimeout(() -> vm.startLocalManagementAgent()); } catch (Exception e) { logger.error("Error starting local management agent", e); } } return address; }
vm.startLocalManagementAgent(); connectorAddress = vm.getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
private static String getJmxUriFromVirtualMachine(VirtualMachine vm) { String connectorAddress = null; try { // Get the local JMX connector URI connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); } catch (IOException e) { throw new IllegalStateException("IOException when fetching JMX URI from JVM with ID: " + vm.id(), e); } // If there is no local JMX connector URI, we need to launch the // JMX agent via this VirtualMachine attachment. if (connectorAddress == null) { LOG.info("Starting local management agent in JVM with ID: " + vm.id()); try { vm.startLocalManagementAgent(); } catch (IOException e) { throw new IllegalStateException("IOException when starting local JMX management agent in JVM with ID: " + vm.id(), e); } // Agent is started, get the connector address try { connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); } catch (IOException e) { throw new IllegalStateException("IOException when fetching JMX URI from JVM with ID: " + vm.id(), e); } } return connectorAddress; }
address = vm.startLocalManagementAgent();
VirtualMachine virtualMachine = VirtualMachine.attach(Long.toString(getProcessId())); try { virtualMachine.startLocalManagementAgent();
VirtualMachine virtualMachine = VirtualMachine.attach(Long.toString(getProcessId())); try { virtualMachine.startLocalManagementAgent();
VirtualMachine virtualMachine = VirtualMachine.attach(Long.toString(getProcessId())); try { virtualMachine.startLocalManagementAgent();