Java Reference
In-Depth Information
A Standard MBean is an MBean that implements its own MBean interface. As
mentioned earlier, the HelloWorld MBean from chapter 2 was a Standard MBean.
It was a concrete class, had a public constructor, and implemented an interface
named HelloWorldMBean .
Enabling notifications
In addition to following the three rules we just listed, all MBeans can optionally
implement the javax.management.NotificationBroadcaster interface. This inter-
face allows MBeans to send notifications to interested listeners. Notifications are
Java objects sent from JMX components to other objects that have registered as
notification listeners. MBeans that implement the NotificationBroadcaster
interface gain methods that allow objects to register with them to receive notifica-
tions. The notification delivery mechanism is very similar to the Java event
model, and is covered in chapter 6.
4.1.2
Using Standard MBeans
Now that you know the rules that all MBeans must follow, let's more closely exam-
ine the Standard MBean. The Standard MBean is an MBean that uses an explic-
itly declared management interface to interact with a manageable resource. A
management interface is the set of methods and attributes exposed by an MBean
that management applications can use to manage a resource (via an MBean).
Standard MBean attributes are class members exposed for management by
the use of getter and setter methods. Standard MBean operations are the public
class methods in addition to the getters and setters. Operations and attributes
are discovered by introspection at the JMX agent level.
Once created, the Standard MBean's management interface does not change.
In addition, more than any other MBean type, it embodies one of the major ben-
efits of using JMX : it is simple. Standard MBeans should be used when the inter-
face to a managed resource is well defined or unlikely to change.
For example, Standard MBeans are good for resources that are still being
developed, because the resource will have a well-known interface and the man-
agement interface can be written explicitly. If you plan to use an MBean to
expose part of a new application in development, you should use a Standard
MBean. The MBean is simple to develop, and you can create it concurrently
with your application. In chapter 5, you will learn about writing MBeans that
are not as straightforward as the Standard MBean. In the following sections,
you will see that the Standard MBean is the simplest way to expose a resource
for management.
Search WWH ::




Custom Search