advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

Tutorials : Soup-to-Nuts Application Management with JMX :

JMX-Tiered Architecture

JMX is based on a three-tier architecture that encourages plug-and-play integration for JMX components. Figure 1 shows a diagram of the JMX architecture:


Figure 1: The JMX Architecture

  • Instrumentation Tier: This tier is used to prepare the manageable resources for JMX support. To accomplish this, you need to know whether a resource can be manageable through JMX. A resource is manageable through JMX if it meets the following criteria:
    • It must be developed in Java (or provides a Java wrapper)
    • It must be an application (Java class, a part of a Java class, a servlet, a JSP page, EJB, and so on), service, device, or user.
    • It must be instrumented through Managed Beans (MBeans), which means it's been written in Java code that conforms to the MBeans specification. This also specifies a notification mechanism that allows MBeans to generate and propagate notification events to components of other levels.
  • Agent Tier: This tier is generally located on the same computer as the managed resources. A JMX agent represents the JMX solution to expose MBeans and control managed resources. This makes them available to remote management applications. The following components comprise a JMX agent:

    • An MBeanServer, which is a server used to register objects that are exposed to an agent's management operations.
    • A set of MBeans, used for representing the managed resources.
    • Agent services implemented as MBeans. For example, a timer service, a monitor service, an MLet service, a relation service, etc.
    • At least one protocol adaptor/connector—like an HTML Adaptor or an RMI connector.

    Agents are developed by writing Java code conforming to a JMX agent's specification.

  • Manager Tier: This last tier facilitates application management in order to communicate with JMX agents. This tier also offers interfaces for implementing JMX managers and defines components/interfaces that operate on JMX agents.
The standard relationship between the manager (protocol adapter, another MBean, etc.), the JMX agent and the managed resource can be seen in Figure 2:


Figure 2: The Manager/JMX Agent/Managed Resource Communication Flow

Creating a Standard MBean

Before you can manage a resource, you have to develop its instrumentation. This means you need to write the corresponding MBean class. The example case in this article exposes static information, which calls for a standard MBean. To write a correct standard MBean, you have to keep in mind the following 11 golden rules:
  1. An MBean cannot be an abstract class.
  2. An MBean must have at least one public constructor.
  3. An MBean must implement an interface that represents the MBean.
  4. The MBean interface name must follow the correct naming convention: {MBean class name}MBean.
  5. MBean attributes can be of type read/write.
  6. Attributes may have any Java type, including array.
  7. An attribute of type read must have a method of type get{attribute name} where the attribute name starts with an upper case letter.
  8. An attribute of type write must have a method of type set{attribute name} where the attribute name starts with an upper case letter.
  9. In the case of a boolean attribute, you can use a method of type is{attribute name} where the attribute name starts with an upper case letter.
  10. Attributes names cannot be overloaded.
  11. Methods that do not represent attributes are known and exposed as operations.
The operations are:
  • startProcess (*): This operation starts the process
  • stopProcess (*): This operation stops the process
  • haltProcess (*): This operation sets stand by on/off, low power, and restarts the process
  • destroyProcess: This operation destroys the process
The attributes and operations you need to expose are marked by (*). The rest are additional attributes/operations that are not available to JMX. In the MBean, the interface will show only the exposed attributes/operations, as you can see below:
public interface MyProcessMBean {

   public String getProcessName();
   public String getProcessMask();
   public boolean isProcessRunning();
   public String getProcessHost();
   public void setProcessPort(int port);
   public int getProcessPort();

   public void startProcess();
   public void stopProcess();
   public void haltProcess(Integer halt);       
}
Next, you'll implement this interface into an MBean, as shown in Listing 1.

Now, that you've got your MBean, it's time to test it!

Home / Articles / Soup-to-Nuts Application Management with JMX / 1 / 2 / Next Page

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Microsoft Visual Studio 2010 Showcase
 Avaya Developer Showcase
 MSDN Spotlight
 PHP for Windows Showcase
XML error: undefined entity at line 39
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Windows 7: From Beta to Final Code in One Year
Google Shows Off Chrome OS, Releases Source
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?
Fedora 12 Takes Aim at Linux Networking
Top Supercomputer Nearly Doubles in Speed
Fedora 12 Linux Tackles Virtualization
Apple Gives iPhone Developers App Status Tracker
Novell Sets OpenSUSE 11.2 Free

Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Exploring HTML 5's Audio/Video Multimedia Support
Overriding Virtual Functions? Use C++0x Attributes to Avoid Bugs.
Understanding the Cloud Computing Security Vulnerabilities
Cisco and IBM Target a Greener World
Upgrade to Visual Studio 2010 with the Ultimate Offer

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs