Java Code Examples for javax.management.remote.JMXConnector

Following code examples demonstrate how to use javax.management.remote.JMXConnector from java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use javax.management.remote.JMXConnector and various code implementation of this class.
Example 1
Project : java Source File : Test.java View Source Code on GitHub

    public static void main(String[] args) {
        try {
            HashMap<String, Object> prop = new HashMap<String, Object>();
            prop.put(JMXConnector.CREDENTIALS, "hello");
            final JMXConnector conn = JMXConnectorFactory.connect(new JMXServiceURL(
                                                                  prop);

            HelloMBean hello = JMX.newMBeanProxy(conn.getMBeanServerConnection(), new ObjectName("hello:name=hello"),
                                                 HelloMBean.class);
            hello.setName("bearice");
            hello.printHello();
            hello.printHello("AAAAAA");
            conn.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
			
Example 2
Project : java Source File : LocalJMXConnector.java View Source Code on GitHub

	public static void main(String[] args) {
		try {
			log("Local JMXServiceURL Test");
			log("URL:[" + jurl.getURLPath() + "]");
			JMXConnector connector = JMXConnectorFactory.connect(jurl, Collections.singletonMap("jmx.remote.protocol.provider.class.loader", LocalJMXConnector.class.getClassLoader()));
			log("Connected to [" + connector.getMBeanServerConnection().getDefaultDomain() + "]");
		} catch (Exception ex) {
			ex.printStackTrace(System.err);
		}		
	}
			
Example 3
Project : java Source File : UpdateableJMXConnector.java View Source Code on GitHub

	public void updateConnector(final JMXConnector connector) {
		final JMXConnector prior = this.connector.getAndSet(connector);
		try { prior.close(); } catch (Exception x) {}
		for(Notif n: notifs) {
			connector.addConnectionNotificationListener(n.listener, n.filter, n.handback);
		}
	}
			
Example 4
Project : java Source File : Mytest.java View Source Code on GitHub

	public static void main(String args[]) {
		final String objectNameStr = "dustin:type=status,name=remoteJMX";    
		 try    
		   {    
			    LocateRegistry.createRegistry(9999);
		        final ObjectName objectName = new ObjectName(objectNameStr);    
		        final JMXServiceURL jmxUrl = new JMXServiceURL(jmxRmiStr);    
		        final JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl);    
		        final MBeanServerConnection mbsc = jmxConnector.getMBeanServerConnection();  
		        System.out.println("b");
		   } catch (Exception e) {
			   e.printStackTrace();
		   }
	}