Sun Microsystems, Inc  JMX Reference Implementation
Tutorial

[ Previous ]
Instantiating and Managing MBeans
[ Contents ]
Contents
[ Next ]
Filtering the MBean List

Standard and Dynamic MBeans

Action:  With an agent view open on another machine, go to the administration page on your machine. Fill in the fields as follows and request the constructors:

      Domain: Standard_MBeans

      Keys  : name=Simple,number=1
  Java Class: Simple

The list of constructors for the Simple class is given at the bottom of the page. The MBean Name is also given: this is the object name that will be assigned to the MBean when using one of the listed constructors. As you can see, the Simple class only has one constructor that takes no parameters.

Action:  Click on its "Create" button: the creation result will be appended to the bottom of the page. Scroll down and go to the MBean view with the provided link.

Simple is a standard MBean so all of its description strings are generic: this shows the necessity of programming meaningful attribute names.

Action:  In the browser on the other machine, click in the filter field and hit Return to refresh the agent view. Click on the new MBean's name and set its reload period to 15. Back on your machine, type in a different different string for the "State" attribute and click "Apply".

On the other machine, you should see the MBean's attributes get updated when the MBean view is periodically reloaded.

Action:  Back on your machine, click the "performReset" operation button at the bottom of the MBean view page. This brings up the operation result page which indicates the success of the operation. This page also gives the return value of the operation when it is not void. If you go back to the MBean view, you will see the result of the operation on the attributes. You should also see it on the other machine after it reloads.

Note: The browser on the other machine is no longer needed for the rest of this tutorial.

Action:  Go to the administration page, create an MBean with the following values, and go to its MBean view:

      Domain: Dynamic_MBeans

      Keys  : name=SimpleDynamic,number=1
  Java Class: SimpleDynamic

The management interface of this dynamic MBean looks similar to that of the Simple class which is a standard MBean. This is because it is programmed to expose a similar interface at run-time. Notice that it has the advantage of providing meaningful description strings. Look at the following source files and compare their features (use your browser's "Previous Page" function to return to the tutorial):


[ Previous ]
Instantiating and Managing MBeans
[ Contents ]
Contents
[ Next ]
Filtering the MBean List

Java coffee cup logo

Copyright © 2000 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA  94303, USA.
All rights reserved.