FTP Online
Search:
Locator+ Code:
FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

Improve Application Management With JMX (Continued)

All three levels revolve around the core concept in the JMX model—a managed bean, or MBean for short. An application is instrumented through managed beans. A managed bean is simply a concrete Java class that obeys certain rules, making objects of that class manageable by the JMX agent (or other MBean-aware agents) in a uniform way. A managed bean provides three types of instrumentation:

  • Access to information through exposed attributes (readable, writable, or both).
  • Reactive behavior through arbitrary published operations.
  • Proactive behavior through notifications to registered listeners.

The main idea behind the MBean concept is the ability to expose dynamic management functionality for a runtime resource. Note, however, that an MBean can be a purely management object that handles the management of several related resources in concert. A programmer creates an MBean either by statically declaring the exposed attributes or operations in a conventional Java interface, or by implementing the special-purpose DynamicMBean interface. The two ways yield functionally equivalent results and, in both cases, the JMX agent and management applications have access to complete metadata about the MBean.

The JMX agent's most important role is providing MBean storage. Its core functionality is embodied in an instance of the MBeanServer interface through which managed beans are registered, created, removed, and searched. To facilitate global management solutions and the integration of disparate application components, a comprehensive naming scheme enables the agent and management applications to uniquely identify MBeans within the MBean server. In addition, management applications can rely on several advanced services the JMX agent provides, such as monitoring attributes' changes, timers, and MBean dynamic loading.

Apply the Technology
Given JMX technology's generality and flexibility, you can leverage it in a myriad of ways. Let me briefly outline some possible applications:

  • Monitoring: Monitoring application and business activity is one of the most basic aspects of application management. You want to know how an application operates: Are there any faults? Is it performing well? What types of resources are insufficient or allocated in excess? Are resources properly released? What kinds of things do users do? By encapsulating such information into managed beans, developers can provide administrators with runtime notifications of suspicious activity, a standard interface to performance statistics, summaries of user activity, details on the state of the system (such as the number of jobs running), and more.
  • Administration: Many applications come with a supporting administration interface. Administrative requirements are specific to the application, but usually fall into several common patterns such as managing user permissions, creating and removing various persistent business objects (such as a forum in an online community or a product listing in an e-commerce application), or managing the lifecycle of various components and services. By using JMX, you can simply expose this type of functionality as MBeans and access it through a common management console, or access it remotely without requiring the programmer to implement an admin user interface or any special-purpose admin services.
  • Management automation: Managing deployed, mission-critical applications is a core business process. Automating this process translates into reliability, effectiveness, reduced costs, and predictability. JMX allows the transformation of any business object into a manageable service through a standard Java programming interface, so you can leverage existing scripting environments to automate repetitive management tasks.
  • Dynamic service configuration: Usually a service is configured as part of the deployment process and the configuration cannot change at run time. JMX allows you to implement an on-the-fly service reconfiguration as part of its management interface. Common configuration examples are tracing level, resource pool size, an operation's timeout parameter, and some functionality's enable/disable flag. Exposing configuration parameters as writable MBean attributes automatically provides administrators with dynamic configuration capability.

A common thread in these scenarios is that instrumenting an application is the only task left to the programmer within the JMX infrastructure. As with any other aspect of application development, the instrumentation process requires proper planning and design. However, the clean decoupling of core business logic from management logic through the use of MBeans greatly facilitates the incorporation of instrumentation even at a later development stage. In the next section, I'll show a concrete programming example of how you can instrument an existing application without disrupting its main code.



Back to top



ADVERTISEMENT

Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTP Home