1 / 17

Managing Components with JMX

Managing Components with JMX. Rickard Öberg JBoss. Overview. Purpose of JMX The JMX architecture A JMX example JMX in JBoss Q&A. Purpose of JMX. JMX=Java Management eXtensions Manage Java components Control Configure Allow portable server components

Download Presentation

Managing Components with JMX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Managing Components with JMX Rickard Öberg JBoss

  2. Overview • Purpose of JMX • The JMX architecture • A JMX example • JMX in JBoss • Q&A

  3. Purpose of JMX • JMX=Java Management eXtensions • Manage Java components • Control • Configure • Allow portable server components • Integrate into existing management systems

  4. The JMX architecture • Three levels • Instrumentation level (MBean) • Agent level (MBeanServer) • Distributed services level (Adaptor)

  5. The JMX architecture

  6. The JMX architecture • Standard MBeans • MBean-specific interface declares methods and attributes • Dynamic MBeans • Implements DynamicMBean interface • Allows info about MBean to change at runtime

  7. The JMX architecture • Model MBeans • Use a ModelMBean through delegation

  8. A JMX example package simplejmx; import javax.management.MBeanRegistration; import javax.management.MBeanServer; import javax.management.ObjectName; public class SimpleBean implements MBeanRegistration, SimpleBeanMBean { String phrase; public SimpleBean() { this("Hello World!"); } public SimpleBean(String phrase) { setPhrase(phrase); }

  9. A JMX example // SimpleBeanMBean implementation public void printPhrase() { System.out.println(phrase); } public void setPhrase(String phrase) { this.phrase = phrase; } public String getPhrase() { return phrase; }

  10. A JMX example // MBeanRegistration implementation public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception { return name == null ? new ObjectName(":service=SimpleBean") : name; } public void postRegister(java.lang.Boolean registrationDone) { if (registrationDone.booleanValue()) printPhrase(); } public void preDeregister() throws java.lang.Exception { } public void postDeregister() { } }

  11. A JMX example package simplejmx; public interface SimpleBeanMBean { public void printPhrase(); public void setPhrase(String phrase); public String getPhrase(); } • Name of interface is MBean class name suffixed with ”MBean” • Results in one manageable method, and one manageable attribute

  12. A JMX example • MLet configuration <MLET CODE = "simplejmx.SimpleBean" ARCHIVE="simplejmx.jar" CODEBASE="../../lib/ext/"> <ARG TYPE="java.lang.String" VALUE="Hey World!"> </MLET> <MLET CODE = "simplejmx.SimpleBean" ARCHIVE="simplejmx.jar" CODEBASE="../../lib/ext/” NAME=”:name=Simple”> </MLET> • ARG list needs to match constructor • Name is optional

  13. JMX in JBoss • JMX is used at core of Jboss • All functionality available as MBeans • Currently only Standard MBean model is used • Integration!

  14. JMX in JBoss • Some additional core services, which are MBeans too, have been added • ServiceControl • Lifecycle management (init/start/stop/destroy) • Configuration • Persistent configuration (as XML)

  15. JMX in JBoss • JBoss configuration XML: <server> <!-- Classloading --> <mbean code="org.jboss.web.WebService" name="DefaultDomain:service=Webserver"> <attribute name="Port">8083</attribute> </mbean> <!-- JNDI --> <mbean code="org.jboss.naming.NamingService" name="DefaultDomain:service=Naming"> <attribute name="Port">1099</attribute> </mbean> <!-- Transactions --> <mbean code="org.jboss.tm.TransactionManagerService" name="DefaultDomain:service=TransactionManager"> <attribute name="TransactionTimeout">300</attribute> </mbean> ...

  16. JMX in JBoss • Logging is done as an MBean, and uses notifications for filtering • Custom RMI adaptor • J2EE deployment services pluggable • EJB container factory is an MBean

  17. Q&A • JMX homepage:http://www.javasoft.com/products/JavaManagement/index.html • http://www.jboss.org • rickard@jboss.org

More Related