Top Description Inners Constructors Methods
sun.management.spi

public abstract Class PlatformMBeanProvider

extends Object
Class Inheritance
Known Direct Subclasses
java.lang.management.DefaultPlatformMBeanProvider
Imports
java.util.Collections, .List, .Map, .ServiceLoader, .Set, java.util.stream.Collectors

The PlatformMBeanProvider class defines the abstract service interface that the java.lang.management.ManagementFactory will invoke to find, load, and register Platform MBeans. ManagementFactory loads the installed providers of this service interface and each provides the platform components that defines MXBean or DynamicMBean to be registered in the platform MBeanServer. A PlatformMBeanProvider will implement the getPlatformComponentList() method to return the list of PlatformComponents it provides.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
PlatformMBeanProvider.PlatformComponent<
The higher level interface for which the MBeans modeled by this object should be recognized. For instance, for the Operating System MXBean, this should be java.lang.management.OperatingSystemMXBean.
T
>

PlatformComponent models MBeans of a management interface supported by the platform.

Constructor Summary

AccessConstructor and Description
protected
PlatformMBeanProvider()

Instantiates a new PlatformMBeanProvider.

Method Summary

Modifier and TypeMethod and Description
public abstract List<PlatformMBeanProvider.PlatformComponent<?>>

Returns:

a list of PlatformComponent instances describing the Platform MBeans provided by this provider.
getPlatformComponentList
()

Returns a list of PlatformComponent instances describing the Platform MBeans provided by this provider.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PlatformMBeanProviderback to summary
protected PlatformMBeanProvider()

Instantiates a new PlatformMBeanProvider.

Method Detail

getPlatformComponentListback to summary
public abstract List<PlatformMBeanProvider.PlatformComponent<?>> getPlatformComponentList()

Returns a list of PlatformComponent instances describing the Platform MBeans provided by this provider.

Returns:List<PlatformMBeanProvider.PlatformComponent<?>>

a list of PlatformComponent instances describing the Platform MBeans provided by this provider.

sun.management.spi back to summary

public Interface PlatformMBeanProvider.PlatformComponent<T>

Type Parameters
<T>
The higher level interface for which the MBeans modeled by this object should be recognized. For instance, for the Operating System MXBean, this should be java.lang.management.OperatingSystemMXBean.

PlatformComponent models MBeans of a management interface supported by the platform. If a PlatformComponent models a singleton MBean, the ObjectName pattern must be the canonical name of that singleton MBean. Otherwise, it must be an ObjectName pattern that can be used to query the MBeans for this PlatformComponent registered in a MBeanServer.
The ObjectName pattern serves as a unique key for identifying the instance of PlatformComponent. It is thus illegal for a given PlatformMBeanProvider to export several instance of PlatformComponent with the same ObjectName pattern string.
If two different provider instances export a PlatformComponent for the same ObjectName pattern, only the PlatformComponent instance of the first provider will be taken into account.

Method Summary

Modifier and TypeMethod and Description
public default <I> List<? extends I>

Returns:

A (possibly empty) list of MBeans implementing the given mbeanIntf.
getMBeans
(Class<I>
A management interface.
mbeanIntf
)

Return the list of MBeans that implement the given mbeanIntf modeled by this PlatformComponent.

public String

Returns:

An ObjectName pattern uniquely identifies the MBeans modeled by this instance.
getObjectNamePattern
()

An ObjectName pattern uniquely identifies the MBeans modeled by this PlatformComponent.

public default boolean

Returns:

true if this instance models a singleton MBean.
isSingleton
()

Returns true if this PlatformComponent models a singleton MBean.

public Set<String>

Returns:

the names of the management interfaces exported by the MBeans modeled by this object.
mbeanInterfaceNames
()

Returns the names of the management interfaces implemented by the MBeans modeled by this PlatformComponent.

public Set<Class<? extends T>>

Returns:

The set of interfaces implemented by the MBeans modeled by this instance
mbeanInterfaces
()

The set of interfaces implemented by the MBeans modeled by this PlatformComponent.

public Map<String, T>

Returns:

A map with, for each MBean, the ObjectName string as key and the MBean as value.
nameToMBeanMap
()

A map from ObjectName string to the MBean instance this PlatformComponent creates.

public default boolean

Returns:

true if the MBeans modeled by this instance should automatically be registered in the Platform MBeanServer.
shouldRegister
()

Returns true if the MBeans modeled by this PlatformComponent should automatically be registered in the Platform MBeanServer.

Method Detail

getMBeansback to summary
public default <I> List<? extends I> getMBeans(Class<I> mbeanIntf)

Return the list of MBeans that implement the given mbeanIntf modeled by this PlatformComponent. This method returns an empty list if no MBean implements the given mbeanIntf.

Implementation Note

This method will be called when ManagementFactory.getPlatformMXBean(mbeanIntf) or ManagementFactory.getPlatformMXBeans(mbeanIntf) are invoked. By default it first checks whether the specified mbeanIntf name is contained in the returned list from the mbeanInterfaceNames() method. If yes, it proceeds and calls mbeans().values() and filters out all MBeans which are not instances of the given mbeanIntf. Otherwise, it returns an empty list.

Parameters
mbeanIntf:Class<I>

A management interface.

Returns:List<? extends I>

A (possibly empty) list of MBeans implementing the given mbeanIntf.

getObjectNamePatternback to summary
public String getObjectNamePattern()

An ObjectName pattern uniquely identifies the MBeans modeled by this PlatformComponent. If this instance models a singleton MBean, this must be the canonical name of that singleton MBean.

Returns:String

An ObjectName pattern uniquely identifies the MBeans modeled by this instance.

isSingletonback to summary
public default boolean isSingleton()

Returns true if this PlatformComponent models a singleton MBean. By default, true is assumed.

Returns:boolean

true if this instance models a singleton MBean.

mbeanInterfaceNamesback to summary
public Set<String> mbeanInterfaceNames()

Returns the names of the management interfaces implemented by the MBeans modeled by this PlatformComponent.

Implementation Note

When ManagementFactory.getPlatformMXBean(mxbeanInterface) or ManagementFactory.getPlatformMXBeans(mxbeanInterface) are invoked, this PlatformComponent instance will match only if the name of the given mxbeanInterface is found in this list.

Returns:Set<String>

the names of the management interfaces exported by the MBeans modeled by this object.

mbeanInterfacesback to summary
public Set<Class<? extends T>> mbeanInterfaces()

The set of interfaces implemented by the MBeans modeled by this PlatformComponent.

Implementation Note

ManagementFactory.getPlatformManagementInterfaces() calls this method to find the management interfaces supported by the platform.

Returns:Set<Class<? extends T>>

The set of interfaces implemented by the MBeans modeled by this instance

nameToMBeanMapback to summary
public Map<String, T> nameToMBeanMap()

A map from ObjectName string to the MBean instance this PlatformComponent creates.

Implementation Note

If shouldRegister() is true, this method will be called when the getPlatformMBeanServer() Platform MBeanServer is initialized. By default, this method will also be called by getMBeans(java.lang.Class), when ManagementFactory.getPlatformMXBean(mxbeanInterface) or ManagementFactory.getPlatformMXBeans(mxbeanInterface) are invoked, and when the name of the given mxbeanInterface is contained in the names of management interfaces returned by mbeanInterfaceNames().

Returns:Map<String, T>

A map with, for each MBean, the ObjectName string as key and the MBean as value.

shouldRegisterback to summary
public default boolean shouldRegister()

Returns true if the MBeans modeled by this PlatformComponent should automatically be registered in the Platform MBeanServer. By default, true is assumed.

Returns:boolean

true if the MBeans modeled by this instance should automatically be registered in the Platform MBeanServer.