Java Code Examples for javax.management.remote.JMXConnectorServer#toJMXConnector()
The following examples show how to use
javax.management.remote.JMXConnectorServer#toJMXConnector() .
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: MapNullValuesTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 2
Source File: MapNullValuesTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 3
Source File: MapNullValuesTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 4
Source File: MapNullValuesTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 5
Source File: MapNullValuesTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 6
Source File: MapNullValuesTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 7
Source File: MapNullValuesTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 8
Source File: MapNullValuesTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 9
Source File: MapNullValuesTest.java From hottub with GNU General Public License v2.0 | 5 votes |
private int jmxConnectorServerFactoryTests() { int errorCount = 0; echo(""); echo(dashedMessage("Run JMXConnectorServerFactory Tests")); for (int i = 0; i < maps.length - 1; i++) { echo("\n>>> JMXConnectorServerFactory Test [" + i + "]"); try { echo("\tMap = " + maps[i]); echo("\tCreate the MBean server"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); echo("\tCreate the RMI connector server"); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" + port + "/JMXConnectorServerFactory" + i); JMXConnectorServer jmxcs = JMXConnectorServerFactory.newJMXConnectorServer(url, maps[i], mbs); echo("\tStart the RMI connector server"); jmxcs.start(); echo("\tCall RMIConnectorServer.toJMXConnector(Map)"); jmxcs.toJMXConnector(maps[i]); echo("\tStop the RMI connector server"); jmxcs.stop(); echo("\tTest [" + i + "] PASSED!"); } catch (Exception e) { errorCount++; echo("\tTest [" + i + "] FAILED!"); e.printStackTrace(System.out); } } if (errorCount == 0) { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!")); } else { echo(""); echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!")); } return errorCount; }
Example 10
Source File: MBSFPreStartPostStartTest.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 11
Source File: MBSFPreStartPostStartTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 12
Source File: MBSFPreStartPostStartTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 13
Source File: MBSFPreStartPostStartTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 14
Source File: MBSFPreStartPostStartTest.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 15
Source File: MBSFPreStartPostStartTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 16
Source File: MBSFPreStartPostStartTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 17
Source File: MBSFPreStartPostStartTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 18
Source File: MBSFPreStartPostStartTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 19
Source File: MBSFPreStartPostStartTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }
Example 20
Source File: MBSFPreStartPostStartTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Run test */ public int runTest(boolean setBeforeStart) throws Exception { echo("=-=-= MBSFPreStartPostStartTest: Set MBSF " + (setBeforeStart ? "before" : "after") + " starting the connector server =-=-="); JMXConnectorServer server = null; JMXConnector client = null; // Create a new MBeanServer // final MBeanServer mbs = MBeanServerFactory.createMBeanServer(); try { // Create the JMXServiceURL // final JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); // Create a JMXConnectorServer // server = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); // Create MBeanServerForwarder // MBeanServerForwarder mbsf = MBSFInvocationHandler.newProxyInstance(); // Set MBeanServerForwarder before start() // if (setBeforeStart) server.setMBeanServerForwarder(mbsf); // Start the JMXConnectorServer // server.start(); // Set MBeanServerForwarder after start() // if (!setBeforeStart) server.setMBeanServerForwarder(mbsf); // Create a JMXConnector // client = server.toJMXConnector(null); // Connect to the connector server // client.connect(null); // Get non-secure MBeanServerConnection // final MBeanServerConnection mbsc = client.getMBeanServerConnection(); // Run method // mbsc.getDefaultDomain(); // Check flag in MBeanServerForwarder // MBSFInvocationHandler mbsfih = (MBSFInvocationHandler) Proxy.getInvocationHandler(mbsf); if (mbsfih.getFlag() == true) { echo("OK: Did go into MBeanServerForwarder!"); } else { echo("KO: Didn't go into MBeanServerForwarder!"); return 1; } } catch (Exception e) { echo("Failed to perform operation: " + e); return 1; } finally { // Close the connection // if (client != null) client.close(); // Stop the connector server // if (server != null) server.stop(); // Release the MBeanServer // if (mbs != null) MBeanServerFactory.releaseMBeanServer(mbs); } return 0; }