1 / 14

JMX

JMX. Java Managment eXtentions. The definition ”Java Management Extensions (JMX) technology provides the tools for building distributed, Web-based, modular and dynamic solutions for managing and monitoring devices, applications, and service-driven networks.

raisie
Download Presentation

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. JMX Java Managment eXtentions

  2. The definition ”Java Management Extensions (JMX) technology provides the tools for building distributed, Web-based, modular and dynamic solutions for managing and monitoring devices, applications, and service-driven networks. By design, this standard is suitable for adapting legacy systems, implementing new management and monitoring solutions, and plugging into those of the future.” Java Managment eXtentions

  3. JMX deliverables Specification API, Documented by Javadoc Reference Implementation (Source, Binarys) Technologi Compatibility Kit (TCK) Java Managment eXtentions

  4. MBean Similar to JavaBean An MBean can represent a device, an application, or any resource that needs to be managed Exposes a management interface Java Managment eXtentions

  5. MBean Managment Interface A set of readable and/or writable attributes A set of invokable operations A Self Description Can emit notifications when certain defined events occur. The management interface does not change throughout the life of an MBean instance Java Managment eXtentions

  6. Interface example By convention an MBean interface takes the name of the Java class that implements it, with the suffix MBean added. package com.example.mbeans; public interface HelloMBean { public void sayHello(); public int add(int x, int y); public String getName(); public int getCacheSize(); public void setCacheSize(int size); } Java Managment eXtentions

  7. Implementation example In therory operations are extremely simple, but real-life operations can be as simple or as sophisticated as you like. package com.example.mbeans; public class Hello implements HelloMBean { public void sayHello() { System.out.println("hello, world"); } public int add(int x, int y) { return x + y; } public String getName() { return this.name; } public int getCacheSize(){ return this.cacheSize; } public synchronized void setCacheSize(int size) { this.cacheSize = size; System.out.println("Cache size now " + this.cacheSize); } private final String name = "Reginald"; private int cacheSize = DEFAULT_CACHE_SIZE; private static final int DEFAULT_CACHE_SIZE = 200; } Java Managment eXtentions

  8. Managing the ressource The object name is an instance of the JMX class ObjectName, and must conform to the syntax defined by the JMX specification, namely it must comprise a domain, and a list of key-properties (see the API documentation for the ObjectName class for details of this syntax). Notification Example: http://java.sun.com/j2se/1.5.0/docs/guide/jmx/tutorial/essential.html#wp1053098 package com.example.mbeans; import java.lang.management.*; import javax.management.*; public class Main { public static void main(String[] args) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("com.example.mbeans:type=Hello"); Hello mbean = new Hello(); mbs.registerMBean(mbean, name); System.out.println("Waiting forever..."); Thread.sleep(Long.MAX_VALUE); } } Java Managment eXtentions

  9. Standard vs. Dynamic MBeans A standard MBean is one that statically defines its management interface through the names of the methods it contains. A dynamic MBean implements a specific Java interface and reveals its attributes and operations at runtime. Java Managment eXtentions

  10. Standard public interface SimpleStandardMBean { public String getState(); public void setState(String s); public int getNbChanges(); public void reset(); } Dynamic public class SimpleDynamic extends NotificationBroadcasterSupport implements DynamicMBean { public SimpleDynamic() { buildDynamicMBeanInfo(); } [...] Java Managment eXtentions

  11. RMI The JMX technology defines a connector based on RMI. The JMX RMI connector supports the standard RMI transports. Java Remote Method Protocol (JRMP) Internet Inter-Object Request Broker (ORB) Protocol (IIOP). Allows you to connect to an MBean in an MBean server from a remote location, and perform operations on it, exactly as if the operations were being performed locally. Java Managment eXtentions

  12. Typical Usage The server: Creates an MBean server Registers a SimpleStandard and a SimpleDynamic MBean in the local MBean server Performs local operations on the MBeans Creates an RMI connector server The client: Creates an RMI connector Registers a SimpleStandard and a SimpleDynamic MBean on the remote MBean server Performs remote operations on both MBeans Java Managment eXtentions

  13. Lookup Service JMX specification defines three bindings to lookup services, using existing lookup technologies. Service Location Protocol (SLP) Jini Lookup Service Java Naming and Directory Interface (JNDI) / LDAP Java Managment eXtentions

  14. Resources The JMXperience: Marketplace to exchange components related to the JMX specification. http://java.sun.com/products/JavaManagement/JMXperience.html JMX Adoption: Companies and/or products that use JMX http://java.sun.com/products/JavaManagement/jmxadoption.html Java Managment eXtentions

More Related