Upload
aubrey-james
View
220
Download
5
Embed Size (px)
Citation preview
Java Management Extensions(JMX)
Jmx Introduction
JMX
What is JMX?Architecture
Instrumentation, Agent and ManagerJMX Components
MBeanServer MBeans (Standard, Dynamic, Model) Notification Adaptors Connectors
Development Kits for JMX
JMX – What is it?
Sun - The Java Management extensions (JMX) provide a standard for instrumenting manageable resources and developing dynamic agents.
Tom – JMX is a standard API and architecture for accessing and controlling Java classes.
JMX - Architecture Instrumentation level - gives instant
manageability to any Java technology-based object.
Agent level - agents are containers that provide core management services which can be dynamically extended by adding JMX resources.
Manager level - provides management components that can operate as a manager or agent for distribution and consolidation of management services.
JMX - Architecture
JMX ComponentsMBeanServer - Contains the methods
necessary for the creation, registration, and deletion of MBeans as well as the access methods for registered MBeans.
MBean – a class whose implementation exposes an interface for allowing management of its attributes and methods. Standard Dynamic Model
Standard MBeanA Standard MBean is a class that
implements a custom MBean interface. It must be a concrete class so that it
can be instantiated. It must expose at least one public
constructor so that any other class can create an instance
Dynamic MBeanA Dynamic MBean implements its
management interface programmatically, instead of through static method names.
Requires implementing the JMX interface java.management.DynamicMBean
DynamicMBean Interfacepublic interface DynamicMBean { public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException;
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException ; public AttributeList getAttributes(String[] attributes); public AttributeList setAttributes(AttributeList attributes); public Object invoke(String actionName, Object params[],
String signature[]) throws MBeanException, ReflectionException ; public MBeanInfo getMBeanInfo();}
Model MBeanDynamic MBean that has been
implemented so that its management interface and its actual resource can be set programmatically.
Accomplished by creating and registering the RequiredModelMBean with the MBeanServer and declaring the manageable resource (called the target object).
Model MBean (cont.)A Descriptor contains the
information describing the Model MBean’s target objects and the policies for accessing the target objects.
The Descriptor is an interface which is implemented in the DescriptorSupport class.
NotificationMBeans, called broadcasters, send
notification events to other registered MBeans or objects, called listeners.
Typical types of notification comes from the MBeanServer (register/unregister events) and MBeans (attribute changes).
All notification events must implement the javax.management.Notification interface.
AdaptorsProtocol adaptors provide a view of
the MBeans registered with a MBeanServer through some communication protocol.
Typically used to provide a user interface for managing the MBeans directly.
Run in the same process as the MBeans and MBeanServer
Examples: HTML or SNMP
ConnectorsProtocol connectors and proxy MBeans
allow for management of MBeans programmatically over a network.
Connector clients expose a remote version of the MBean server interface. The connector server transmits management requests to the MBean server and forwards any replies.
Example: RMI, HTTP or IIOP
JMX – Tool kitsJMX Reference Implementation – free
core implementation of the basic JMX interfaces.
Java Dynamic Management Kit (JDMK) – Sun’s full implementation of the JMX specification. Includes HTML, RMI, and SNMP adapters.
A few others being developed. Will likely be standard in most application servers.
ResourcesJMX Site -
http://java.sun.com/products/JavaManagement/
JMX White Paper - http://java.sun.com/products/JavaManagement/wp/
JavaWorld JMX article - http://www.javaworld.com/javaworld/jw-06-2001/jw-0608-jmx.html
JDMK Site - http://java.sun.com/products/jdmk