java.lang.management

Class ManagementFactory

    • Field Detail

      • GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE

        public static final String GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
        The domain name and the type key property in the ObjectName for a GarbageCollectorMXBean. The unique ObjectName for a GarbageCollectorMXBean can be formed by appending this string with ",name=collector's name".
        See Also:
        Constant Field Values
      • MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE

        public static final String MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
        The domain name and the type key property in the ObjectName for a MemoryManagerMXBean. The unique ObjectName for a MemoryManagerMXBean can be formed by appending this string with ",name=manager's name".
        See Also:
        Constant Field Values
      • MEMORY_POOL_MXBEAN_DOMAIN_TYPE

        public static final String MEMORY_POOL_MXBEAN_DOMAIN_TYPE
        The domain name and the type key property in the ObjectName for a MemoryPoolMXBean. The unique ObjectName for a MemoryPoolMXBean can be formed by appending this string with ,name=pool's name.
        See Also:
        Constant Field Values
    • Method Detail

      • getClassLoadingMXBean

        public static ClassLoadingMXBean getClassLoadingMXBean()
        Returns the managed bean for the class loading system of the Java virtual machine.
        Returns:
        a ClassLoadingMXBean object for the Java virtual machine.
      • getMemoryMXBean

        public static MemoryMXBean getMemoryMXBean()
        Returns the managed bean for the memory system of the Java virtual machine.
        Returns:
        a MemoryMXBean object for the Java virtual machine.
      • getThreadMXBean

        public static ThreadMXBean getThreadMXBean()
        Returns the managed bean for the thread system of the Java virtual machine.
        Returns:
        a ThreadMXBean object for the Java virtual machine.
      • getRuntimeMXBean

        public static RuntimeMXBean getRuntimeMXBean()
        Returns the managed bean for the runtime system of the Java virtual machine.
        Returns:
        a RuntimeMXBean object for the Java virtual machine.
      • getCompilationMXBean

        public static CompilationMXBean getCompilationMXBean()
        Returns the managed bean for the compilation system of the Java virtual machine. This method returns null if the Java virtual machine has no compilation system.
        Returns:
        a CompilationMXBean object for the Java virtual machine or null if the Java virtual machine has no compilation system.
      • getOperatingSystemMXBean

        public static OperatingSystemMXBean getOperatingSystemMXBean()
        Returns the managed bean for the operating system on which the Java virtual machine is running.
        Returns:
        an OperatingSystemMXBean object for the Java virtual machine.
      • getMemoryPoolMXBeans

        public static List<MemoryPoolMXBean> getMemoryPoolMXBeans()
        Returns a list of MemoryPoolMXBean objects in the Java virtual machine. The Java virtual machine can have one or more memory pools. It may add or remove memory pools during execution.
        Returns:
        a list of MemoryPoolMXBean objects.
      • getMemoryManagerMXBeans

        public static List<MemoryManagerMXBean> getMemoryManagerMXBeans()
        Returns a list of MemoryManagerMXBean objects in the Java virtual machine. The Java virtual machine can have one or more memory managers. It may add or remove memory managers during execution.
        Returns:
        a list of MemoryManagerMXBean objects.
      • getGarbageCollectorMXBeans

        public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans()
        Returns a list of GarbageCollectorMXBean objects in the Java virtual machine. The Java virtual machine may have one or more GarbageCollectorMXBean objects. It may add or remove GarbageCollectorMXBean during execution.
        Returns:
        a list of GarbageCollectorMXBean objects.
      • getPlatformMBeanServer

        public static MBeanServer getPlatformMBeanServer()
        Returns the platform MBeanServer. On the first call to this method, it first creates the platform MBeanServer by calling the MBeanServerFactory.createMBeanServer method and registers each platform MXBean in this platform MBeanServer with its ObjectName. This method, in subsequent calls, will simply return the initially created platform MBeanServer.

        MXBeans that get created and destroyed dynamically, for example, memory pools and managers, will automatically be registered and deregistered into the platform MBeanServer.

        If the system property javax.management.builder.initial is set, the platform MBeanServer creation will be done by the specified MBeanServerBuilder.

        It is recommended that this platform MBeanServer also be used to register other application managed beans besides the platform MXBeans. This will allow all MBeans to be published through the same MBeanServer and hence allow for easier network publishing and discovery. Name conflicts with the platform MXBeans should be avoided.

        Returns:
        the platform MBeanServer; the platform MXBeans are registered into the platform MBeanServer at the first time this method is called.
        Throws:
        SecurityException - if there is a security manager and the caller does not have the permission required by MBeanServerFactory.createMBeanServer().
        See Also:
        MBeanServerFactory, MBeanServerFactory.createMBeanServer()
      • newPlatformMXBeanProxy

        public static <T> T newPlatformMXBeanProxy(MBeanServerConnection connection,
                                   String mxbeanName,
                                   Class<T> mxbeanInterface)
                                        throws IOException
        Returns a proxy for a platform MXBean interface of a given MXBean name that forwards its method calls through the given MBeanServerConnection.

        This method is equivalent to:

        Proxy.newProxyInstance(mxbeanInterface.getClassLoader(), new Class[] { mxbeanInterface }, handler)
        where handler is an InvocationHandler to which method invocations to the MXBean interface are dispatched. This handler converts an input parameter from an MXBean data type to its mapped open type before forwarding to the MBeanServer and converts a return value from an MXBean method call through the MBeanServer from an open type to the corresponding return type declared in the MXBean interface.

        If the MXBean is a notification emitter (i.e., it implements NotificationEmitter), both the mxbeanInterface and NotificationEmitter will be implemented by this proxy.

        Notes:

        1. Using an MXBean proxy is a convenience remote access to a platform MXBean of a running virtual machine. All method calls to the MXBean proxy are forwarded to an MBeanServerConnection where IOException may be thrown when the communication problem occurs with the connector server. An application remotely accesses the platform MXBeans using proxy should prepare to catch IOException as if accessing with the MBeanServerConnector interface.
        2. When a client application is designed to remotely access MXBeans for a running virtual machine whose version is different than the version on which the application is running, it should prepare to catch InvalidObjectException which is thrown when an MXBean proxy receives a name of an enum constant which is missing in the enum class loaded in the client application.
        3. MBeanServerInvocationHandler or its newProxyInstance method cannot be used to create a proxy for a platform MXBean. The proxy object created by MBeanServerInvocationHandler does not handle the properties of the platform MXBeans described in the class specification.
        Parameters:
        connection - the MBeanServerConnection to forward to.
        mxbeanName - the name of a platform MXBean within connection to forward to. mxbeanName must be in the format of ObjectName.
        mxbeanInterface - the MXBean interface to be implemented by the proxy.
        Throws:
        IllegalArgumentException - if
        • mxbeanName is not with a valid ObjectName format, or
        • the named MXBean in the connection is not a MXBean provided by the platform, or
        • the named MXBean is not registered in the MBeanServerConnection, or
        • the named MXBean is not an instance of the given mxbeanInterface
        IOException - if a communication problem occurred when accessing the MBeanServerConnection.
      • getPlatformMXBean

        public static <T extends PlatformManagedObject> T getPlatformMXBean(Class<T> mxbeanInterface)
        Returns the platform MXBean implementing the given mxbeanInterface which is specified to have one single instance in the Java virtual machine. This method may return null if the management interface is not implemented in the Java virtual machine (for example, a Java virtual machine with no compilation system does not implement CompilationMXBean); otherwise, this method is equivalent to calling:
            getPlatformMXBeans(mxbeanInterface).get(0);
         
        Parameters:
        mxbeanInterface - a management interface for a platform MXBean with one single instance in the Java virtual machine if implemented.
        Returns:
        the platform MXBean that implements mxbeanInterface, or null if not exist.
        Throws:
        IllegalArgumentException - if mxbeanInterface is not a platform management interface or not a singleton platform MXBean.
        Since:
        1.7
      • getPlatformMXBeans

        public static <T extends PlatformManagedObjectList<T> getPlatformMXBeans(Class<T> mxbeanInterface)
        Returns the list of platform MXBeans implementing the given mxbeanInterface in the Java virtual machine. The returned list may contain zero, one, or more instances. The number of instances in the returned list is defined in the specification of the given management interface. The order is undefined and there is no guarantee that the list returned is in the same order as previous invocations.
        Parameters:
        mxbeanInterface - a management interface for a platform MXBean
        Returns:
        the list of platform MXBeans that implement mxbeanInterface.
        Throws:
        IllegalArgumentException - if mxbeanInterface is not a platform management interface.
        Since:
        1.7
      • getPlatformMXBean

        public static <T extends PlatformManagedObject> T getPlatformMXBean(MBeanServerConnection connection,
                                                            Class<T> mxbeanInterface)
                                                                 throws IOException
        Returns the platform MXBean proxy for mxbeanInterface which is specified to have one single instance in a Java virtual machine and the proxy will forward the method calls through the given MBeanServerConnection. This method may return null if the management interface is not implemented in the Java virtual machine being monitored (for example, a Java virtual machine with no compilation system does not implement CompilationMXBean); otherwise, this method is equivalent to calling:
             getPlatformMXBeans(connection, mxbeanInterface).get(0);
         
        Parameters:
        connection - the MBeanServerConnection to forward to.
        mxbeanInterface - a management interface for a platform MXBean with one single instance in the Java virtual machine being monitored, if implemented.
        Returns:
        the platform MXBean proxy for forwarding the method calls of the mxbeanInterface through the given MBeanServerConnection, or null if not exist.
        Throws:
        IllegalArgumentException - if mxbeanInterface is not a platform management interface or not a singleton platform MXBean.
        IOException - if a communication problem occurred when accessing the MBeanServerConnection.
        Since:
        1.7
        See Also:
        newPlatformMXBeanProxy(javax.management.MBeanServerConnection, java.lang.String, java.lang.Class<T>)
      • getPlatformMXBeans

        public static <T extends PlatformManagedObjectList<T> getPlatformMXBeans(MBeanServerConnection connection,
                                                                   Class<T> mxbeanInterface)
                                                                        throws IOException
        Returns the list of the platform MXBean proxies for forwarding the method calls of the mxbeanInterface through the given MBeanServerConnection. The returned list may contain zero, one, or more instances. The number of instances in the returned list is defined in the specification of the given management interface. The order is undefined and there is no guarantee that the list returned is in the same order as previous invocations.
        Parameters:
        connection - the MBeanServerConnection to forward to.
        mxbeanInterface - a management interface for a platform MXBean
        Returns:
        the list of platform MXBean proxies for forwarding the method calls of the mxbeanInterface through the given MBeanServerConnection.
        Throws:
        IllegalArgumentException - if mxbeanInterface is not a platform management interface.
        IOException - if a communication problem occurred when accessing the MBeanServerConnection.
        Since:
        1.7
        See Also:
        newPlatformMXBeanProxy(javax.management.MBeanServerConnection, java.lang.String, java.lang.Class<T>)
      • getPlatformManagementInterfaces

        public static Set<Class<? extends PlatformManagedObject>> getPlatformManagementInterfaces()
        Returns the set of Class objects, subinterface of PlatformManagedObject, representing all management interfaces for monitoring and managing the Java platform.
        Returns:
        the set of Class objects, subinterface of PlatformManagedObject representing the management interfaces for monitoring and managing the Java platform.
        Since:
        1.7

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

05/11/2024 15:02:01 Cette version de la page est en cache (à la date du 05/11/2024 15:02:01) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/lang/management/ManagementFactory.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, ManagementFactory

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut