|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.management.MBeanServerFactory
This class provides references to the MBeanServer objects and acts as a factory for creating creating and releasing the references of MBeanServer objects.
This class makes it possible to replace the default MBeanServer
implementation. This is done using the
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
MBeanServerBuilder, and must have a public
empty constructor.
By default, if no value for that property is specified, an instance of
javax.management.MBeanServerBuilder
is created. Otherwise, the MBeanServerFactory attempts to load the
specified class using
Thread.currentThread().getContextClassLoader(), or if that is null,
Class.forName(). Then
it creates an initial instance of that Class using
Class.newInstance(). If any checked exception
is raised during this process (e.g.
ClassNotFoundException,
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.
| Method Summary | |
(package private) static void |
Get Logger Instance |
static MBeanServer |
createMBeanServer()
Return a new object implementing the MBeanServer interface with a standard default domain name. |
static MBeanServer |
createMBeanServer(java.lang.String domain)
Return a new object implementing the MBeanServer
interface with the specified default domain name. |
static java.util.ArrayList |
findMBeanServer(java.lang.String agentId)
Return a list of registered MBeanServer objects. |
static ClassLoaderRepository |
getClassLoaderRepository(MBeanServer server)
Return the ClassLoaderRepository used by the given MBeanServer. |
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. |
static MBeanServer |
newMBeanServer(java.lang.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. |
static void |
releaseMBeanServer(MBeanServer mbeanServer)
Releases all the internal references for a MBeanServer object, thus making the MBeanServer instance a valid object for Garbage Collection. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Method Detail |
static void()
public static MBeanServer createMBeanServer()
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).
MBeanServerPermission("createMBeanServer").javax.management.builder.initial exists but the
class it names cannot be instantiated through a public
no-argument constructor; or if the instantiated builder returns
null from its newMBeanServerDelegate or newMBeanServer methods.javax.management.builder.initial exists and can be
instantiated but is not assignment compatible with MBeanServerBuilder.public static MBeanServer createMBeanServer(java.lang.String domain)
Return a new object implementing the 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.
domain - the default domain name for the created
MBeanServer. This is the value that will be returned by MBeanServer.getDefaultDomain().MBeanServerPermission("createMBeanServer").javax.management.builder.initial exists but the
class it names cannot be instantiated through a public
no-argument constructor; or if the instantiated builder returns
null from its newMBeanServerDelegate or newMBeanServer methods.javax.management.builder.initial exists and can be
instantiated but is not assignment compatible with MBeanServerBuilder.public static ClassLoaderRepository getClassLoaderRepository(MBeanServer server)
MBeanPermission("getClassLoaderRepository").server is null.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.
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).
MBeanServerPermission("newMBeanServer").javax.management.builder.initial exists but the
class it names cannot be instantiated through a public
no-argument constructor; or if the instantiated builder returns
null from its newMBeanServerDelegate or newMBeanServer methods.javax.management.builder.initial exists and can be
instantiated but is not assignment compatible with MBeanServerBuilder.public static MBeanServer newMBeanServer(java.lang.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.
domain - the default domain name for the created
MBeanServer. This is the value that will be returned by MBeanServer.getDefaultDomain().MBeanServerPermission("newMBeanServer").javax.management.builder.initial exists but the
class it names cannot be instantiated through a public
no-argument constructor; or if the instantiated builder returns
null from its newMBeanServerDelegate or newMBeanServer methods.javax.management.builder.initial exists and can be
instantiated but is not assignment compatible with MBeanServerBuilder.public static void releaseMBeanServer(MBeanServer mbeanServer)
public static java.util.ArrayList findMBeanServer(java.lang.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.
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.MBeanServerPermission("findMBeanServer").
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||