Presentation is loading. Please wait.

Presentation is loading. Please wait.

Managing Components with JMX

Similar presentations


Presentation on theme: "Managing Components with JMX"— 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 Dynamic 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() 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
<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”> 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> <!-- Transactions --> <mbean code="org.jboss.tm.TransactionManagerService" name="DefaultDomain:service=TransactionManager"> <attribute name="TransactionTimeout">300</attribute> ...

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"

Similar presentations


Ads by Google