This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.management
class MBeanServerFactory

java.lang.Object extended by javax.management.MBeanServerFactory

public class MBeanServerFactory
extends Object

Provides MBean server references. There are no instances of this class.

Since JMX 1.2 this class makes it possible to replace the default MBeanServer implementation. This is done using the {@link javax.management.MBeanServerBuilder} class. The class of the initial MBeanServerBuilder to be instantiated can be specified through the javax.management.builder.initial system property. The specified class must be a public subclass of {@link javax.management.MBeanServerBuilder}, and must have a public empty constructor.

By default, if no value for that property is specified, an instance of {@link javax.management.MBeanServerBuilder javax.management.MBeanServerBuilder} is created. Otherwise, the MBeanServerFactory attempts to load the specified class using {@link java.lang.Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()}, or if that is null, {@link java.lang.Class#forName(java.lang.String) Class.forName()}. Then it creates an initial instance of that Class using {@link java.lang.Class#newInstance()}. If any checked exception is raised during this process (e.g. {@link java.lang.ClassNotFoundException}, {@link java.lang.InstantiationException}) the MBeanServerFactory will propagate this exception from within a RuntimeException.

The javax.management.builder.initial system property is consulted every time a new MBeanServer needs to be created, and the class pointed to by that property is loaded. If that class is different from that of the current MBeanServerBuilder, then a new MBeanServerBuilder is created. Otherwise, the MBeanServerFactory may create a new MBeanServerBuilder or reuse the current one.

If the class pointed to by the property cannot be loaded, or does not correspond to a valid subclass of MBeanServerBuilder then an exception is propagated, and no MBeanServer can be created until the javax.management.builder.initial system property is reset to valid value.

The MBeanServerBuilder makes it possible to wrap the MBeanServers returned by the default MBeanServerBuilder implementation, for the purpose of e.g. adding an additional security layer.


Method Summary
static MBeanServer

          Return a new object implementing the MBeanServer interface with a standard default domain name.
static MBeanServer

          Return a new object implementing the javax.management.MBeanServer interface with the specified default domain name.
static ArrayList

          Return a list of registered MBeanServer objects.
static ClassLoaderRepository

          Return the ClassLoaderRepository used by the given MBeanServer.
static MBeanServer

          Return a new object implementing the MBeanServer interface with a standard default domain name, without keeping an internal reference to this new object.
static MBeanServer

          Return a new object implementing the MBeanServer interface with the specified default domain name, without keeping an internal reference to this new object.
static void

          Remove internal MBeanServerFactory references to a created MBeanServer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMBeanServer

public static MBeanServer createMBeanServer()

Return a new object implementing the MBeanServer interface with a standard default domain name. The default domain name is used as the domain part in the ObjectName of MBeans when the domain is specified by the user is null.

The standard default domain name is DefaultDomain.

The MBeanServer reference is internally kept. This will allow findMBeanServer to return a reference to this MBeanServer object.

This method is equivalent to createMBeanServer(null).

Returns:
the newly created MBeanServer.

createMBeanServer

public static MBeanServer createMBeanServer(String domain)

Return a new object implementing the {@link MBeanServer} interface with the specified default domain name. The given domain name is used as the domain part in the ObjectName of MBeans when the domain is specified by the user is null.

The MBeanServer reference is internally kept. This will allow findMBeanServer to return a reference to this MBeanServer object.

Parameters:
domain - the default domain name for the created MBeanServer. This is the value that will be returned by {@link MBeanServer#getDefaultDomain}.
Returns:
the newly created MBeanServer.

findMBeanServer

public static synchronized ArrayList findMBeanServer(String agentId)

Return a list of registered MBeanServer objects. A registered MBeanServer object is one that was created by one of the createMBeanServer methods and not subsequently released with releaseMBeanServer.

Parameters:
agentId - The agent identifier of the MBeanServer to retrieve. If this parameter is null, all registered MBeanServers in this JVM are returned. Otherwise, only MBeanServers whose id is equal to agentId are returned. The id of an MBeanServer is the MBeanServerId attribute of its delegate MBean.
Returns:
A list of MBeanServer objects.

getClassLoaderRepository

public static ClassLoaderRepository getClassLoaderRepository(MBeanServer server)
Return the ClassLoaderRepository used by the given MBeanServer. This method is equivalent to {@link MBeanServer#getClassLoaderRepository() server.getClassLoaderRepository()}.

Parameters:
server - The MBeanServer under examination. Since JMX 1.2, if server is null, the result is a {@link NullPointerException}. This behavior differs from what was implemented in JMX 1.1 - where the possibility to use null was deprecated.
Returns:
The Class Loader Repository used by the given MBeanServer.

newMBeanServer

public static MBeanServer newMBeanServer()

Return a new object implementing the MBeanServer interface with a standard default domain name, without keeping an internal reference to this new object. The default domain name is used as the domain part in the ObjectName of MBeans when the domain is specified by the user is null.

The standard default domain name is DefaultDomain.

No reference is kept. findMBeanServer will not be able to return a reference to this MBeanServer object, but the garbage collector will be able to remove the MBeanServer object when it is no longer referenced.

This method is equivalent to newMBeanServer(null).

Returns:
the newly created MBeanServer.

newMBeanServer

public static MBeanServer newMBeanServer(String domain)

Return a new object implementing the MBeanServer interface with the specified default domain name, without keeping an internal reference to this new object. The given domain name is used as the domain part in the ObjectName of MBeans when the domain is specified by the user is null.

No reference is kept. findMBeanServer will not be able to return a reference to this MBeanServer object, but the garbage collector will be able to remove the MBeanServer object when it is no longer referenced.

Parameters:
domain - the default domain name for the created MBeanServer. This is the value that will be returned by {@link MBeanServer#getDefaultDomain}.
Returns:
the newly created MBeanServer.

releaseMBeanServer

public static void releaseMBeanServer(MBeanServer mbeanServer)
Remove internal MBeanServerFactory references to a created MBeanServer. This allows the garbage collector to remove the MBeanServer object.

Parameters:
mbeanServer - the MBeanServer object to remove.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.