Save This Page
Home » openjdk-7 » com.sun.jmx » mbeanserver » [javadoc | source]
com.sun.jmx.mbeanserver
public final class: JmxMBeanServer [javadoc | source]
java.lang.Object
   com.sun.jmx.mbeanserver.JmxMBeanServer

All Implemented Interfaces:
    SunJmxMBeanServer

This is the base class for MBean manipulation on the agent side. It contains the methods necessary for the creation, registration, and deletion of MBeans as well as the access methods for registered MBeans. This is the core component of the JMX infrastructure.

Every MBean which is added to the MBean server becomes manageable: its attributes and operations become remotely accessible through the connectors/adaptors connected to that MBean server. A Java object cannot be registered in the MBean server unless it is a JMX compliant MBean.

When an MBean is registered or unregistered in the MBean server an MBeanServerNotification Notification is emitted. To register an object as listener to MBeanServerNotifications you should call the MBean server method addNotificationListener with the ObjectName of the MBeanServerDelegate . This ObjectName is:
JMImplementation:type=MBeanServerDelegate.

Field Summary
public static final  boolean DEFAULT_FAIR_LOCK_POLICY    Control the default locking policy of the repository. By default, we will be using a fair locking policy. 
Constructor:
 JmxMBeanServer(String domain,
    MBeanServer outer,
    MBeanServerDelegate delegate) 
    Parameters:
    domain - The default domain name used by this MBeanServer.
    outer - A pointer to the MBeanServer object that must be passed to the MBeans when invoking their javax.management.MBeanRegistration interface.
    delegate - A pointer to the MBeanServerDelegate associated with the new MBeanServer. The new MBeanServer must register this MBean in its MBean repository.
    Throws:
    IllegalArgumentException - if the instantiator is null.
    exception: IllegalArgumentException - if the instantiator is null.
 JmxMBeanServer(String domain,
    MBeanServer outer,
    MBeanServerDelegate delegate,
    boolean interceptors) 
    Parameters:
    domain - The default domain name used by this MBeanServer.
    outer - A pointer to the MBeanServer object that must be passed to the MBeans when invoking their javax.management.MBeanRegistration interface.
    delegate - A pointer to the MBeanServerDelegate associated with the new MBeanServer. The new MBeanServer must register this MBean in its MBean repository.
    interceptors - If true, MBeanServerInterceptor will be enabled (default is false) Note: this parameter is not taken into account by this implementation - the default value false is always used.
    Throws:
    IllegalArgumentException - if the instantiator is null.
    exception: IllegalArgumentException - if the instantiator is null.
 JmxMBeanServer(String domain,
    MBeanServer outer,
    MBeanServerDelegate delegate,
    MBeanInstantiator instantiator,
    boolean interceptors) 
    Package: Creates an MBeanServer.
    Parameters:
    domain - The default domain name used by this MBeanServer.
    outer - A pointer to the MBeanServer object that must be passed to the MBeans when invoking their javax.management.MBeanRegistration interface.
    delegate - A pointer to the MBeanServerDelegate associated with the new MBeanServer. The new MBeanServer must register this MBean in its MBean repository.
    instantiator - The MBeanInstantiator that will be used to instantiate MBeans and take care of class loading issues.
    metadata - The MetaData object that will be used by the MBean server in order to invoke the MBean interface of the registered MBeans.
    interceptors - If true, MBeanServerInterceptor will be enabled (default is false).
 JmxMBeanServer(String domain,
    MBeanServer outer,
    MBeanServerDelegate delegate,
    MBeanInstantiator instantiator,
    boolean interceptors,
    boolean fairLock) 
    Package: Creates an MBeanServer.
    Parameters:
    domain - The default domain name used by this MBeanServer.
    outer - A pointer to the MBeanServer object that must be passed to the MBeans when invoking their javax.management.MBeanRegistration interface.
    delegate - A pointer to the MBeanServerDelegate associated with the new MBeanServer. The new MBeanServer must register this MBean in its MBean repository.
    instantiator - The MBeanInstantiator that will be used to instantiate MBeans and take care of class loading issues.
    metadata - The MetaData object that will be used by the MBean server in order to invoke the MBean interface of the registered MBeans.
    interceptors - If true, MBeanServerInterceptor will be enabled (default is false).
    fairLock - If {@code true}, the MBean repository will use a fair locking policy.
Method from com.sun.jmx.mbeanserver.JmxMBeanServer Summary:
addNotificationListener,   addNotificationListener,   createMBean,   createMBean,   createMBean,   createMBean,   deserialize,   deserialize,   deserialize,   getAttribute,   getAttributes,   getClassLoader,   getClassLoaderFor,   getClassLoaderRepository,   getDefaultDomain,   getDomains,   getMBeanCount,   getMBeanInfo,   getMBeanInstantiator,   getMBeanServerDelegate,   getMBeanServerInterceptor,   getObjectInstance,   instantiate,   instantiate,   instantiate,   instantiate,   interceptorsEnabled,   invoke,   isInstanceOf,   isRegistered,   newMBeanServer,   newMBeanServerDelegate,   queryMBeans,   queryNames,   registerMBean,   removeNotificationListener,   removeNotificationListener,   removeNotificationListener,   removeNotificationListener,   setAttribute,   setAttributes,   setMBeanServerInterceptor,   unregisterMBean
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.jmx.mbeanserver.JmxMBeanServer Detail:
 public  void addNotificationListener(ObjectName name,
    NotificationListener listener,
    NotificationFilter filter,
    Object handback) throws InstanceNotFoundException 
    Adds a listener to a registered MBean.
 public  void addNotificationListener(ObjectName name,
    ObjectName listener,
    NotificationFilter filter,
    Object handback) throws InstanceNotFoundException 
    Adds a listener to a registered MBean.
 public ObjectInstance createMBean(String className,
    ObjectName name) throws MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException, ReflectionException, MBeanException 
    Instantiates and registers an MBean in the MBean server. The MBean server will use its Default Loader Repository to load the class of the MBean. An object name is associated to the MBean. If the object name given is null, the MBean can automatically provide its own name by implementing the MBeanRegistration interface. The call returns an ObjectInstance object representing the newly created MBean.
 public ObjectInstance createMBean(String className,
    ObjectName name,
    ObjectName loaderName) throws InstanceNotFoundException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException, ReflectionException, MBeanException 
    Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name. An object name is associated to the MBean. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used. If the MBean's object name given is null, the MBean can automatically provide its own name by implementing the MBeanRegistration interface. The call returns an ObjectInstance object representing the newly created MBean.
 public ObjectInstance createMBean(String className,
    ObjectName name,
    Object[] params,
    String[] signature) throws MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException, ReflectionException, MBeanException 
    Instantiates and registers an MBean in the MBean server. The MBean server will use its Default Loader Repository to load the class of the MBean. An object name is associated to the MBean. If the object name given is null, the MBean can automatically provide its own name by implementing the MBeanRegistration interface. The call returns an ObjectInstance object representing the newly created MBean.
 public ObjectInstance createMBean(String className,
    ObjectName name,
    ObjectName loaderName,
    Object[] params,
    String[] signature) throws InstanceNotFoundException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException, ReflectionException, MBeanException 
    Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name. An object name is associated to the MBean. If the object name of the loader is not specified, the ClassLoader that loaded the MBean server will be used. If the MBean object name given is null, the MBean can automatically provide its own name by implementing the MBeanRegistration interface. The call returns an ObjectInstance object representing the newly created MBean.
 public ObjectInputStream deserialize(ObjectName name,
    byte[] data) throws InstanceNotFoundException, OperationsException 
    De-serializes a byte array in the context of the class loader of an MBean.
 public ObjectInputStream deserialize(String className,
    byte[] data) throws ReflectionException, OperationsException 
    De-serializes a byte array in the context of a given MBean class loader. The class loader is the one that loaded the class with name "className".
 public ObjectInputStream deserialize(String className,
    ObjectName loaderName,
    byte[] data) throws InstanceNotFoundException, ReflectionException, OperationsException 
    De-serializes a byte array in the context of a given MBean class loader. The class loader is the one that loaded the class with name "className". The name of the class loader to be used for loading the specified class is specified. If null, the MBean Server's class loader will be used.
 public Object getAttribute(ObjectName name,
    String attribute) throws InstanceNotFoundException, ReflectionException, AttributeNotFoundException, MBeanException 
    Gets the value of a specific attribute of a named MBean. The MBean is identified by its object name.
 public AttributeList getAttributes(ObjectName name,
    String[] attributes) throws InstanceNotFoundException, ReflectionException 
    Enables the values of several attributes of a named MBean. The MBean is identified by its object name.
 public ClassLoader getClassLoader(ObjectName loaderName) throws InstanceNotFoundException 
 public ClassLoader getClassLoaderFor(ObjectName mbeanName) throws InstanceNotFoundException 
 public ClassLoaderRepository getClassLoaderRepository() 

    Return the ClassLoaderRepository for that MBeanServer.

 public String getDefaultDomain() 
    Returns the default domain used for naming the MBean. The default domain name is used as the domain part in the ObjectName of MBeans if no domain is specified by the user.
 public String[] getDomains() 
 public Integer getMBeanCount() 
    Returns the number of MBeans registered in the MBean server.
 public MBeanInfo getMBeanInfo(ObjectName name) throws IntrospectionException, InstanceNotFoundException, ReflectionException 
    This method discovers the attributes and operations that an MBean exposes for management.
 public MBeanInstantiator getMBeanInstantiator() 
    Return the MBeanInstantiator associated to this MBeanServer.
 public MBeanServerDelegate getMBeanServerDelegate() 
 public synchronized MBeanServerInterceptor getMBeanServerInterceptor() 
    Return the MBeanServerInterceptor.
 public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException 
    Gets the ObjectInstance for a given MBean registered with the MBean server.
 public Object instantiate(String className) throws ReflectionException, MBeanException 
    Instantiates an object using the list of all class loaders registered in the MBean server (using its Default Loader Repository ). The object's class should have a public constructor. It returns a reference to the newly created object. The newly created object is not registered in the MBean server.
 public Object instantiate(String className,
    ObjectName loaderName) throws InstanceNotFoundException, ReflectionException, MBeanException 
    Instantiates an object using the class Loader specified by its ObjectName. If the loader name is null, the ClassLoader that loaded the MBean Server will be used. The object's class should have a public constructor. It returns a reference to the newly created object. The newly created object is not registered in the MBean server.
 public Object instantiate(String className,
    Object[] params,
    String[] signature) throws ReflectionException, MBeanException 
    Instantiates an object using the list of all class loaders registered in the MBean server (using its Default Loader Repository ). The object's class should have a public constructor. The call returns a reference to the newly created object. The newly created object is not registered in the MBean server.
 public Object instantiate(String className,
    ObjectName loaderName,
    Object[] params,
    String[] signature) throws InstanceNotFoundException, ReflectionException, MBeanException 
    Instantiates an object. The class loader to be used is identified by its object name. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used. The object's class should have a public constructor. The call returns a reference to the newly created object. The newly created object is not registered in the MBean server.
 public boolean interceptorsEnabled() 
 public Object invoke(ObjectName name,
    String operationName,
    Object[] params,
    String[] signature) throws InstanceNotFoundException, ReflectionException, MBeanException 
    Invokes an operation on an MBean.
 public boolean isInstanceOf(ObjectName name,
    String className) throws InstanceNotFoundException 
    Returns true if the MBean specified is an instance of the specified class, false otherwise.
 public boolean isRegistered(ObjectName name) 
    Checks whether an MBean, identified by its object name, is already registered with the MBean server.
 public static MBeanServer newMBeanServer(String defaultDomain,
    MBeanServer outer,
    MBeanServerDelegate delegate,
    boolean interceptors) 
    This method creates a new MBeanServer implementation object. When creating a new MBeanServer the javax.management.MBeanServerBuilder first calls newMBeanServerDelegate() in order to obtain a new javax.management.MBeanServerDelegate for the new MBeanServer. Then it calls newMBeanServer(defaultDomain,outer,delegate) passing the delegate that should be used by the MBeanServer implementation.

    Note that the passed delegate might not be directly the MBeanServerDelegate that was returned by this implementation. It could be, for instance, a new object wrapping the previously returned delegate.

    The outer parameter is a pointer to the MBeanServer that should be passed to the javax.management.MBeanRegistration interface when registering MBeans inside the MBeanServer. If outer is null, then the MBeanServer implementation is free to use its own this pointer when invoking the javax.management.MBeanRegistration interface.

    This makes it possible for a MBeanServer implementation to wrap another MBeanServer implementation, in order to implement, e.g, security checks, or to prevent access to the actual MBeanServer implementation by returning a pointer to a wrapping object.

 public static MBeanServerDelegate newMBeanServerDelegate() 
    This method creates a new MBeanServerDelegate for a new MBeanServer. When creating a new MBeanServer the javax.management.MBeanServerBuilder first calls this method in order to create a new MBeanServerDelegate.
    Then it calls newMBeanServer(defaultDomain,outer,delegate,interceptors) passing the delegate that should be used by the MBeanServer implementation.

    Note that the passed delegate might not be directly the MBeanServerDelegate that was returned by this method. It could be, for instance, a new object wrapping the previously returned object.

 public Set queryMBeans(ObjectName name,
    QueryExp query) 
    Gets MBeans controlled by the MBean server. This method allows any of the following to be obtained: All MBeans, a set of MBeans specified by pattern matching on the ObjectName and/or a Query expression, a specific MBean. When the object name is null or no domain and key properties are specified, all objects are to be selected (and filtered if a query is specified). It returns the set of ObjectInstance objects (containing the ObjectName and the Java Class name) for the selected MBeans.
 public Set queryNames(ObjectName name,
    QueryExp query) 
    Gets the names of MBeans controlled by the MBean server. This method enables any of the following to be obtained: The names of all MBeans, the names of a set of MBeans specified by pattern matching on the ObjectName and/or a Query expression, a specific MBean name (equivalent to testing whether an MBean is registered). When the object name is null or or no domain and key properties are specified, all objects are selected (and filtered if a query is specified). It returns the set of ObjectNames for the MBeans selected.
 public ObjectInstance registerMBean(Object object,
    ObjectName name) throws MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException 
    Registers a pre-existing object as an MBean with the MBean server. If the object name given is null, the MBean may automatically provide its own name by implementing the MBeanRegistration interface. The call returns an ObjectInstance object representing the registered MBean.
 public  void removeNotificationListener(ObjectName name,
    NotificationListener listener) throws ListenerNotFoundException, InstanceNotFoundException 
 public  void removeNotificationListener(ObjectName name,
    ObjectName listener) throws ListenerNotFoundException, InstanceNotFoundException 
 public  void removeNotificationListener(ObjectName name,
    NotificationListener listener,
    NotificationFilter filter,
    Object handback) throws ListenerNotFoundException, InstanceNotFoundException 
 public  void removeNotificationListener(ObjectName name,
    ObjectName listener,
    NotificationFilter filter,
    Object handback) throws ListenerNotFoundException, InstanceNotFoundException 
 public  void setAttribute(ObjectName name,
    Attribute attribute) throws InstanceNotFoundException, InvalidAttributeValueException, ReflectionException, AttributeNotFoundException, MBeanException 
    Sets the value of a specific attribute of a named MBean. The MBean is identified by its object name.
 public AttributeList setAttributes(ObjectName name,
    AttributeList attributes) throws InstanceNotFoundException, ReflectionException 
    Sets the values of several attributes of a named MBean. The MBean is identified by its object name.
 public synchronized  void setMBeanServerInterceptor(MBeanServerInterceptor interceptor) 
    Set the MBeanServerInterceptor.
 public  void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException 
    De-registers an MBean from the MBean server. The MBean is identified by its object name. Once the method has been invoked, the MBean may no longer be accessed by its object name.