JMX Registered Mbean Service

Source: Internet
Author: User


try {String DOMAIN = "localhost";//Create a mbeanserver mbeanserver server = Mbeanserverfactory.creatembeanserver (DOMAIN); /with Mbeanserver Registration the Loginstatsmbean//Mbeanserver.registermbean (Object,objectname) method uses two parameters: one is an instance of an Mbean implementation The other is an object of type ObjectName-it is used to uniquely identify the Mbean Server.registermbean (New Status (), New ObjectName (DOMAIN + ": Name=statusbean") ); Url:jmxserviceurl URL to access the JMX service = new Jmxserviceurl ("RMI", "127.0.0.1", 9589, "/jndi/rmi://localhost:" + 1099 + "/app") ; Start () and stop () to start and stop jmxconnectorserver jmxconnectorserver jmxserver = Jmxconnectorserverfactory.newjmxconnectorserver (URL, null, server); System.out.println (URL); Register Locateregistry.createregistry (1099) on the RMI; Jmxserver.start (); } catch (Exception e) {e.printstacktrace ();}

The public method inside the Mbean can be accessed through Jconsole:

Enter the JMX service Url:service:jmx:rmi:///jndi/rmi://localhost:1099/app in the JMX URL

You can access the methods in the Mbean that you have registered to.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.