|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
Package javax.managementProvides the core classes for the Java Management Extensions.
See:
Package javax.management Description
Provides the core classes for the Java Management Extensions. The Java Management Extensions (JMXTM) API is a standard API for management and monitoring. Typical uses include:
The JMX API can also be used as part of a solution for managing systems, networks, and so on. The API includes remote access, so a remote management program can interact with a running application for these purposes. MBeansThe fundamental notion of the JMX API is the MBean. An MBean is a named managed object representing a resource. It has a management interface consisting of:
For example, an MBean representing an application's
configuration could have attributes representing the different
configuration items. Reading the In the standard usage of the JMX API, MBeans are implemented as Java objects. However, as explained below, these objects are not usually referenced directly. Standard MBeansTo make MBean implementation simple, the JMX API includes the notion of Standard MBeans. A Standard MBean is one whose attributes and operations are deduced from a Java interface using certain naming patterns, similar to those used by JavaBeansTM. For example, consider an interface like this: public interface ConfigurationMBean { public int getCacheSize(); public void setCacheSize(int size); public long getLastChangedTime(); public void save(); } The methods The method The method The exact naming patterns for Standard MBeans are detailed in the JMX Specification. There are two ways to make a Java object that is an MBean
with this management interface. One is for the object to be
of a class that has exactly the same name as the Java
interface but without the Dynamic MBeansA Dynamic MBean is an MBean that defines its management interface at run-time. For example, a configuration MBean could determine the names and types of the attributes it exposes by parsing an XML file. Any Java object of a class that implements the Open MBeansAn Open MBean is a kind of Dynamic MBean where the
types of attributes and of operation parameters and return
values are built using a small set of predefined Java classes.
Open MBeans facilitate operation with remote management programs
that do not necessarily have access to application-specific
types, including non-Java programs. Open MBeans are defined by
the package Model MBeansA Model MBean is a kind of Dynamic MBean that acts
as a bridge between the management interface and the
underlying managed resource. Both the management interface and
the managed resource are specified as Java objects. The same
Model MBean implementation can be reused many times with
different management interfaces and managed resources, and it can
provide common functionality such as persistence and caching.
Model MBeans are defined by the package
MBean ServerTo be useful, an MBean must be registered in an MBean
Server. An MBean Server is a repository of MBeans.
Usually the only access to the MBeans is through the MBean
Server. In other words, code no longer accesses the Java
object implementing the MBean directly, but instead accesses
the MBean by name through the MBean Server. Each MBean has a
unique name within the MBean Server, defined by the An MBean Server is an object implementing the interface
Application code can also create a new MBean Server, or
access already-created MBean Servers, using the Creating MBeans in the MBean ServerThere are two ways to create an MBean. One is to construct a
Java object that will be the MBean, then use the The An MBean can perform actions when it is registered in or
unregistered from an MBean Server if it implements the Accessing MBeans in the MBean ServerGiven an
int cacheSize = mbs.getAttribute(name, "CacheSize");
Alternatively, if you have a Java interface that corresponds to the management interface for the MBean, you can use an MBean proxy like this:
ConfigurationMBean conf = (ConfigurationMBean)
Using an MBean proxy is just a convenience. The second
example ends up calling the same An MBean Server can be queried for MBeans whose names match
certain patterns and/or whose attributes meet certain
constraints. Name patterns are constructed using the NotificationsA notification is an instance of the An MBean that will emit notifications must implement the
Notifications can be received by a listener, which
is an object that implements the An MBean can be a listener for notifications emitted by other
MBeans in the same MBean Server. In this case, it implements
Remote Access to MBeansAn MBean Server can be accessed remotely through a
connector. A connector allows a remote Java
application to access an MBean Server in essentially the same
way as a local one. The package
The JMX specification also defines the notion of an
adaptor. An adaptor translates between requests in a
protocol such as SNMP or HTML and accesses to an MBean Server.
So for example an SNMP GET operation might result in a
Package Specification
Copyright 2003 Sun Microsystems, Inc. All rights reserved
|