Presentation is loading. Please wait.

Presentation is loading. Please wait.

Managing Components with JMX Rickard Öberg JBoss.

Similar presentations

Presentation on theme: "Managing Components with JMX Rickard Öberg JBoss."— 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 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; import; import; 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 –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: 8083 1099 300...

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:

Download ppt "Managing Components with JMX Rickard Öberg JBoss."

Similar presentations

Ads by Google