org.springframework.jmx.support

Class MBeanRegistrationSupport

  • java.lang.Object
    • org.springframework.jmx.support.MBeanRegistrationSupport
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected Log logger
      Log instance for this class.
      protected javax.management.MBeanServer server
      The MBeanServer instance being used to register beans.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected void doRegister(java.lang.Object mbean, javax.management.ObjectName objectName)
      Actually register the MBean with the server.
      protected void doUnregister(javax.management.ObjectName objectName)
      Actually unregister the specified MBean from the server.
      protected javax.management.ObjectName[] getRegisteredObjectNames()
      Return the ObjectNames of all registered beans.
      javax.management.MBeanServer getServer()
      Return the MBeanServer that the beans will be registered with.
      protected void onRegister(javax.management.ObjectName objectName)
      Called when an MBean is registered under the given ObjectName.
      protected void onRegister(javax.management.ObjectName objectName, java.lang.Object mbean)
      Called when an MBean is registered under the given ObjectName.
      protected void onUnregister(javax.management.ObjectName objectName)
      Called when an MBean is unregistered under the given ObjectName.
      void setRegistrationPolicy(RegistrationPolicy registrationPolicy)
      The policy to use when attempting to register an MBean under an ObjectName that already exists.
      void setServer(javax.management.MBeanServer server)
      Specify the MBeanServer instance with which all beans should be registered.
      protected void unregisterBeans()
      Unregisters all beans that have been registered by an instance of this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        protected final Log logger
        Log instance for this class.
      • server

        @Nullable
        protected javax.management.MBeanServer server
        The MBeanServer instance being used to register beans.
    • Constructor Detail

      • MBeanRegistrationSupport

        public MBeanRegistrationSupport()
    • Method Detail

      • setServer

        public void setServer(@Nullable
                              javax.management.MBeanServer server)
        Specify the MBeanServer instance with which all beans should be registered. The MBeanExporter will attempt to locate an existing MBeanServer if none is supplied.
      • getServer

        @Nullable
        public final javax.management.MBeanServer getServer()
        Return the MBeanServer that the beans will be registered with.
      • setRegistrationPolicy

        public void setRegistrationPolicy(RegistrationPolicy registrationPolicy)
        The policy to use when attempting to register an MBean under an ObjectName that already exists.
        Parameters:
        registrationPolicy - the policy to use
        Since:
        3.2
      • doRegister

        protected void doRegister(java.lang.Object mbean,
                                  javax.management.ObjectName objectName)
                           throws javax.management.JMException
        Actually register the MBean with the server. The behavior when encountering an existing MBean can be configured using setRegistrationPolicy(org.springframework.jmx.support.RegistrationPolicy).
        Parameters:
        mbean - the MBean instance
        objectName - the suggested ObjectName for the MBean
        Throws:
        javax.management.JMException - if the registration failed
      • unregisterBeans

        protected void unregisterBeans()
        Unregisters all beans that have been registered by an instance of this class.
      • doUnregister

        protected void doUnregister(javax.management.ObjectName objectName)
        Actually unregister the specified MBean from the server.
        Parameters:
        objectName - the suggested ObjectName for the MBean
      • getRegisteredObjectNames

        protected final javax.management.ObjectName[] getRegisteredObjectNames()
        Return the ObjectNames of all registered beans.
      • onRegister

        protected void onRegister(javax.management.ObjectName objectName,
                                  java.lang.Object mbean)
        Called when an MBean is registered under the given ObjectName. Allows subclasses to perform additional processing when an MBean is registered.

        The default implementation delegates to onRegister(ObjectName).

        Parameters:
        objectName - the actual ObjectName that the MBean was registered with
        mbean - the registered MBean instance
      • onRegister

        protected void onRegister(javax.management.ObjectName objectName)
        Called when an MBean is registered under the given ObjectName. Allows subclasses to perform additional processing when an MBean is registered.

        The default implementation is empty. Can be overridden in subclasses.

        Parameters:
        objectName - the actual ObjectName that the MBean was registered with
      • onUnregister

        protected void onUnregister(javax.management.ObjectName objectName)
        Called when an MBean is unregistered under the given ObjectName. Allows subclasses to perform additional processing when an MBean is unregistered.

        The default implementation is empty. Can be overridden in subclasses.

        Parameters:
        objectName - the ObjectName that the MBean was registered with