Java Reference
In-Depth Information
Before we move on to the last type of MBean, it is time you learned more about the
JMX notification model. In chapters 4 and 5, we delayed covering JMX notifica-
tions in order to focus on the construction of the two basic types of MBeans. This
chapter will show you how to make MBeans more beneficial by adding notifica-
tions. JMX notifications can be used to inform other objects or processes of impor-
tant events, state changes, or statistical information from managed resources.
The JMX notification model is similar to the Java event model in that it pro-
vides a callback mechanism for interested listeners that have implemented specific
interfaces. In this case, the notification model allows MBeans to send notification
objects to interested listeners. Notifications are Java objects, like events; they con-
tain information populated by an MBean, and are sent to other objects that have
registered as listeners.
This chapter discusses sending and receiving notifications from MBeans. In
subsequent chapters, you will begin including notifications into examples
where appropriate.
6.1 Using MBean notifications
JMX is a powerful tool used to expose applications for management and moni-
toring. The first few chapters have given you a good feel for how you can use
JMX to expose your own resources for management. However, exposing resources
for management is only part of an application management solution. Manage-
ment applications need to be informed about the state , or critical events, of a
managed resource.
For example, imagine you have instrumented an application critical to your
business (recall that instrumentation is the process of exposing a resource through
MBeans). You are having success maintaining that application by using MBeans
and a management tool, but you come to work one day and the application has
crashed. The MBean should have been able to inform you that the application
had gone into an error state and needed help.
In addition, consider MBeans used to control customer service applications.
One particular MBean might need to send a notification when a specific cus-
tomer help flag is raised.
The JMX notification model can help in such situations. By using notifica-
tions, you let your MBeans speak to the other objects, applications, and so forth.
In turn, those notification receivers (or listeners) can take appropriate action: for
example, they can contact pagers or other applications.
Search WWH ::




Custom Search