Java Reference
In-Depth Information
A domain name— The domain name usually coincides with the domain
name of the MBeanServer in which the MBean wants to register. When it
does not, it is usually meant to segregate one MBean from the others.
A key=value property list— Property name/value pairs are used to uniquely
identify MBeans, and also to provide information about the MBean. The
object name may be the first representation a user will see of your MBean.
You can supply information such as names, port values, locations, and pur-
poses with a few property values.
In this case, the ObjectName for the HelloWorld MBean looks like this:
"HelloAgent:name=helloWorld1"
Now that you have an ObjectName instance, you will be able to identify and find
the MBean once it is registered.
Registering and starting the HTML adapter
As previously mentioned, the agent creates an ObjectName for the adapter and
registers the adapter in the MBeanServer object. Because they are MBeans, each
adapter can choose to expose as many attributes as necessary for configuration
by a management application.
Even though at this point in the code the adapter has been created and regis-
tered, management applications still cannot contact it. For clients to make use of
the HTML adapter, it must be started. To start the adapter, you call its start()
method. The start() method tells the adapter MBean to begin listening for
HTTP clients on the default port of 9092. The HelloAgent is now ready to receive
client calls.
E
2.3.2
More about object names
We bri ef l y desc ri bed an ObjectName value in the previous section. Having com-
pleted the code examination, let's return our focus to the ObjectName class. As
you noticed, object names have a specific structure that must be followed when
constructing a value.
Figure 2.4 shows the structure of an ObjectName value.
Domain names
Domain names provides context for the agent in relation to other agents. For
example, an agent might be created to contain MBeans managing resources on
a particular computer. In this case, the domain could be the computer's host-
name. A domain name does not have to be a meaningful value like a computer's
Search WWH ::




Custom Search