Java Code Examples for sun.management.ConnectorAddressLink#importFrom()
The following examples show how to use
sun.management.ConnectorAddressLink#importFrom() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMXClient.java From ns4_gear_watchdog with Apache License 2.0 | 5 votes |
private static JMXServiceURL getLocalStubServiceURLFromPID(int pid) throws IOException { String address = ConnectorAddressLink.importFrom(pid); if (address != null) { return new JMXServiceURL(address); } return null; }
Example 2
Source File: TestManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 3
Source File: TestManager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 4
Source File: TestManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 5
Source File: TestManager.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 6
Source File: TestManager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 7
Source File: TestManager.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 8
Source File: TestManager.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 9
Source File: TestManager.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and load // management-agent.jar startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 10
Source File: TestManager.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and load // management-agent.jar startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 11
Source File: TestManager.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 12
Source File: LocalVirtualMachine.java From jmxmon with Apache License 2.0 | 5 votes |
private static void getMonitoredVMs(Map<Integer, LocalVirtualMachine> map) { MonitoredHost host; Set vms; try { host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null)); vms = host.activeVms(); } catch (java.net.URISyntaxException sx) { throw new InternalError(sx.getMessage()); } catch (MonitorException mx) { throw new InternalError(mx.getMessage()); } for (Object vmid: vms) { if (vmid instanceof Integer) { int pid = ((Integer) vmid).intValue(); String name = vmid.toString(); // default to pid if name not available boolean attachable = false; String address = null; try { MonitoredVm mvm = host.getMonitoredVm(new VmIdentifier(name)); // use the command line as the display name name = MonitoredVmUtil.commandLine(mvm); attachable = MonitoredVmUtil.isAttachable(mvm); address = ConnectorAddressLink.importFrom(pid); mvm.detach(); } catch (Exception x) { // ignore } map.put((Integer) vmid, new LocalVirtualMachine(pid, name, attachable, address)); } } }
Example 13
Source File: TestManager.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 14
Source File: TestManager.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { String pid = args[0]; // pid as a string System.out.println("Starting TestManager for PID = " + pid); System.out.flush(); VirtualMachine vm = VirtualMachine.attach(pid); String agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); int vmid = Integer.parseInt(pid); String jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); if (agentPropLocalConnectorAddress == null && jvmstatLocalConnectorAddress == null) { // No JMX Connector address so attach to VM, and start local agent startManagementAgent(pid); agentPropLocalConnectorAddress = (String) vm.getAgentProperties().get(LOCAL_CONNECTOR_ADDRESS_PROP); jvmstatLocalConnectorAddress = ConnectorAddressLink.importFrom(vmid); } // Test address obtained from agent properties System.out.println("Testing the connector address from agent properties"); connect(pid, agentPropLocalConnectorAddress); // Test address obtained from jvmstat buffer System.out.println("Testing the connector address from jvmstat buffer"); connect(pid, jvmstatLocalConnectorAddress); // Shutdown application int port = Integer.parseInt(args[1]); System.out.println("Shutdown process via TCP port: " + port); Socket s = new Socket(); s.connect(new InetSocketAddress(port)); s.close(); }
Example 15
Source File: LocalVirtualMachine.java From jvmtop with GNU General Public License v2.0 | 4 votes |
private static void getMonitoredVMs(Map<Integer, LocalVirtualMachine> map, Map<Integer, LocalVirtualMachine> existingMap) { //Unsupported on J9 if (J9Mode) { return; } MonitoredHost host; Set vms; try { host = MonitoredHost.getMonitoredHost(new HostIdentifier((String) null)); vms = host.activeVms(); } catch (java.net.URISyntaxException sx) { throw new InternalError(sx.getMessage()); } catch (MonitorException mx) { throw new InternalError(mx.getMessage()); } for (Object vmid : vms) { if (existingMap.containsKey(vmid)) { continue; } if (vmid instanceof Integer) { int pid = ((Integer) vmid).intValue(); String name = vmid.toString(); // default to pid if name not available boolean attachable = false; String address = null; try { MonitoredVm mvm = host.getMonitoredVm(new VmIdentifier(name)); // use the command line as the display name name = MonitoredVmUtil.commandLine(mvm); attachable = MonitoredVmUtil.isAttachable(mvm); address = ConnectorAddressLink.importFrom(pid); mvm.detach(); } catch (Exception x) { // ignore } map.put((Integer) vmid, new LocalVirtualMachine(pid, name, attachable, address)); } } }
Example 16
Source File: JMXGet.java From RDFS with Apache License 2.0 | 4 votes |
/** * @param args * @throws Exception * initializes MBeanServer */ public void init() throws Exception{ err("init: server="+server+";port="+port+";service="+ service+";localVMPid="+localVMPid); String url_string = null; // build connection url if (localVMPid != null) { // from the file /tmp/hsperfdata* url_string = ConnectorAddressLink.importFrom(Integer.parseInt(localVMPid)); } else if (!port.isEmpty() && !server.isEmpty()) { // using server and port url_string = "service:jmx:rmi:///jndi/rmi://"+server+ ":"+port+"/jmxrmi"; } // else url stays null // Create an RMI connector client and // connect it to the RMI connector server if (url_string == null) { //assume local vm (for example for Testing) mbsc = ManagementFactory.getPlatformMBeanServer(); } else { JMXServiceURL url = new JMXServiceURL(url_string); err("Create RMI connector and connect to the RMI connector server" + url); JMXConnector jmxc = JMXConnectorFactory.connect(url, null); // Get an MBeanServerConnection // err("\nGet an MBeanServerConnection"); mbsc = jmxc.getMBeanServerConnection(); } // Get domains from MBeanServer // err("\nDomains:"); String domains[] = mbsc.getDomains(); Arrays.sort(domains); for (String domain : domains) { err("\tDomain = " + domain); } // Get MBeanServer's default domain // err("\nMBeanServer default domain = " + mbsc.getDefaultDomain()); // Get MBean count // err("\nMBean count = " + mbsc.getMBeanCount()); // Query MBean names for specific domain "hadoop" and service ObjectName query = new ObjectName("hadoop:service="+service+",*"); hadoopObjectNames = new ArrayList<ObjectName>(5); err("\nQuery MBeanServer MBeans:"); Set<ObjectName> names = new TreeSet<ObjectName>(mbsc.queryNames(query, null)); for (ObjectName name : names) { hadoopObjectNames.add(name); err("hadoop services: " + name); } }