类 RequiredModelMBean

java.lang.Object
javax.management.modelmbean.RequiredModelMBean
所有已实现的接口:
DynamicMBean , MBeanRegistration , ModelMBean , ModelMBeanNotificationBroadcaster , NotificationBroadcaster , NotificationEmitter , PersistentMBean

public class RequiredModelMBean extends Object implements ModelMBean , MBeanRegistration , NotificationEmitter
此类是 ModelMBean 的实现。每个 JMX 代理都必须附带 ModelMBean 的适当实现,并且该类必须命名为 RequiredModelMBean。

希望易于管理的 Java 资源使用 MBeanServer 的 createMBean 方法实例化 RequiredModelMBean。该资源然后为 RequiredModelMBean 实例设置 MBeanInfo 和 Descriptors。通过 ModelMBeanInfo 为 ModelMBean 公开的属性和操作可从 MBean、连接器/适配器(如其他 MBean)访问。通过描述符,托管应用程序中的值和方法可以被定义并映射到 ModelMBean 的属性和操作。此map可以在 XML 格式的文件中定义,也可以在运行时以编程方式动态定义。

在 MBeanServer 中实例化的每个 RequiredModelMBean 都变得易于管理:
它的属性和操作可以通过连接到该 MBeanServer 的连接器/适配器进行远程访问。

Java 对象不能在 MBeanServer 中注册,除非它是符合 JMX 的 MBean。通过实例化 RequiredModelMBean,资源可以保证 MBean 有效。必须在每个公共方法上抛出 MBeanException 和 RuntimeOperationsException。这允许包装来自分布式通信(RMI、EJB 等)的异常

自从:
1.5
  • 构造方法详细信息

  • 方法详情

    • setModelMBeanInfo

      public void setModelMBeanInfo(ModelMBeanInfo  mbi) throws MBeanException , RuntimeOperationsException
      使用传入的 ModelMBeanInfo 初始化 ModelMBean 对象。只要 ModelMBean 未注册到 MBeanServer,此方法就可以在 ModelMBean 上设置自定义的 ModelMBeanInfo。
      一旦 ModelMBean 的 ModelMBeanInfo(带有描述符)被定制并设置在 ModelMBean 上,ModelMBean 就被注册到 MBeanServer。

      如果 ModelMBean 当前已注册,此方法将抛出一个 RuntimeOperationsException 包装一个 IllegalStateException

      如果给定inModelMBeanInfo不包含用于 GENERICATTRIBUTE_CHANGE 通知的任何 ModelMBeanNotificationInfo ,则 RequiredModelMBean 将为那些丢失的通知提供其自己的默认 ModelMBeanNotificationInfo

      指定者:
      setModelMBeanInfo 在接口 ModelMBean
      参数:
      mbi - ModelMBean 使用的 ModelMBeanInfo 对象。
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException -
    • setManagedResource

      设置要针对其执行此 ModelMBean 管理接口(MBeanInfo 和描述符)中的所有方法的对象的实例句柄。
      指定者:
      setManagedResource 在接口 ModelMBean
      参数:
      mr - 作为托管资源的对象
      mr_type - 托管资源的引用类型。
      可以是:“ObjectReference”、“Handle”、“IOR”、“EJBHandle”或“RMIReference”。
      在此实现中,仅支持“ObjectReference”。
      抛出:
      MBeanException - 对象的初始值设定项引发了异常。
      InstanceNotFoundException - 找不到托管资源对象
      InvalidTargetObjectTypeException - 托管资源类型应为“ObjectReference”。
      RuntimeOperationsException - 在设置资源时包装一个 RuntimeException
    • load

      使用在持久存储中为 MBean 找到的数据实例化此 MBean 实例。加载的数据可以包括属性和操作值。

      应该在构造或初始化此实例期间以及在 MBean 注册到 MBeanServer 之前调用此方法。

      如果此类的实现不支持持久性,则会抛出一个包装 ServiceNotFoundException MBeanException

      指定者:
      load 在接口 PersistentMBean
      抛出:
      MBeanException - 包装另一个异常,或者不支持持久化
      RuntimeOperationsException - 包装来自持久性机制的异常
      InstanceNotFoundException - 无法从持久存储中找到或加载此 MBean
    • store

      捕获此 MBean 实例的当前状态并将其写出到持久存储。存储的状态可以包括属性和操作值。

      如果此类的实现不支持持久性,则会抛出一个包装 ServiceNotFoundException MBeanException

      来自 MBean 和属性描述符的持久性策略用于指导此方法的执行。如果“persistPolicy”字段为:

       != "never"
        = "always"
        = "onTimer" and now > 'lastPersistTime' + 'persistPeriod'
        = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod'
        = "onUnregister"
       

      如果 'persistPolicy' 字段是: 不要存储 MBean:

        = "never"
        = "onUpdate"
        = "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
       
      指定者:
      store 在接口 PersistentMBean
      抛出:
      MBeanException - 包装另一个异常,或者不支持持久化
      RuntimeOperationsException - 包装来自持久性机制的异常
      InstanceNotFoundException - 无法找到/访问持久存储
    • getMBeanInfo

      public MBeanInfo  getMBeanInfo()
      返回此 RequiredModelMBean 为管理而公开的属性、操作、构造方法和通知。
      指定者:
      getMBeanInfo 在接口 DynamicMBean
      返回:
      ModelMBeanInfo 的一个实例,允许检索此 MBean 的所有属性、操作和通知。
    • invoke

      public Object  invoke(String  opName, Object [] opArgs, String [] sig) throws MBeanException , ReflectionException
      在 RequiredModelMBean 上或通过 RequiredModelMBean 调用方法并返回方法执行的结果。

      如果要调用的给定方法连同提供的签名与 RequiredModelMbean 可访问方法之一匹配,则将调用该方法。否则,将在托管资源上尝试对给定方法的调用。

      操作返回的最后一个值可能缓存在操作的描述符中,该描述符位于 ModelMBeanOperationInfo 的描述符中。如果有,则有效值将在“值”字段中。如果描述符中的“currencyTimeLimit”字段是:

      • <0然后该值不会被缓存并且永远不会有效。操作方法被调用。 “值”和“lastUpdatedTimeStamp”字段被清除。
      • =0然后该值始终被缓存并且始终有效。返回“值”字段。如果没有“值”字段,则为该属性调用操作方法。 “lastUpdatedTimeStamp”字段和“value”字段设置为操作的返回值和当前时间戳。
      • >0表示“值”字段有效的秒数。当 'lastUpdatedTimeStamp' + 'currencyTimeLimit' > Now 时,'value' 字段不再有效。
        • 当“值”有效时,返回“值”。
        • 当“值”不再有效时,将调用操作方法。 “lastUpdatedTimeStamp”字段和“value”字段已更新。

      笔记:由于本规范以前版本的不一致,建议不要对 currencyTimeLimit 使用负值或零值。要指示缓存值永远无效,请省略 currencyTimeLimit 字段。要指示它始终有效,请为此字段使用一个非常大的数字。

      指定者:
      invoke 在接口 DynamicMBean
      参数:
      opName - 要调用的方法的名称。该名称可以是包括类名的完全限定方法名,或者如果类名是在操作描述符的“类”字段中定义的,则只是方法名。
      opArgs - 包含调用操作时要设置的参数的数组
      sig - 包含操作签名的数组。将使用与用于加载调用操作的 MBean 的类加载器相同的类加载器来加载类对象。
      返回:
      方法返回的对象,表示在指定的托管资源上调用该方法的结果。
      抛出:
      MBeanException - 包装以下异常之一:
      ReflectionException - 包装在尝试调用该方法时抛出的 Exception
      RuntimeOperationsException - 包装一个 IllegalArgumentException 方法名称为空。
    • getAttribute

      public Object  getAttribute(String  attrName) throws AttributeNotFoundException , MBeanException , ReflectionException
      返回为此 ModelMBean 定义的特定属性的值。属性返回的最后一个值可以缓存在属性的描述符中。如果有,则有效值将在“值”字段中。如果描述符中的“currencyTimeLimit”字段是:
      • <0然后该值不会被缓存并且永远不会有效。为属性调用 getter 方法。 “值”和“lastUpdatedTimeStamp”字段被清除。
      • =0然后该值始终被缓存并且始终有效。返回“值”字段。如果没有“值”字段,则为该属性调用 getter 方法。 “lastUpdatedTimeStamp”字段和“value”字段设置为属性的值和当前时间戳。
      • >0表示“值”字段有效的秒数。当 'lastUpdatedTimeStamp' + 'currencyTimeLimit' > Now 时,'value' 字段不再有效。
        • 当“值”有效时,返回“值”。
        • 当“值”不再有效时,将为该属性调用 getter 方法。 “lastUpdatedTimeStamp”字段和“value”字段已更新。

      笔记:由于本规范以前版本的不一致,建议不要对 currencyTimeLimit 使用负值或零值。要指示缓存值永远无效,请省略 currencyTimeLimit 字段。要指示它始终有效,请为此字段使用一个非常大的数字。

      如果“getMethod”字段包含有效操作描述符的名称,则执行操作描述符描述的方法。方法的响应作为属性值返回。如果操作失败或返回值与声明的属性类型不兼容,将抛出异常。

      如果未定义“getMethod”字段,则返回属性的默认值。如果返回值与声明的属性类型不兼容,将抛出异常。

      声明的属性类型是 MBeanAttributeInfo.getType() 返回的字符串。如果满足以下条件之一,则值与此类型兼容:

      • 该值为空;
      • 声明的名称是原始类型名称(如“int”),值是相应包装类型的实例(如java.lang.Integer);
      • 值类的名称与声明的名称相同;
      • 声明的名称可以由值的类加载器加载,并生成一个可以分配该值的类。

      在此实现中,在需要调用 getMethod 的每种情况下,因为该方法是通过标准“invoke”方法调用的,因此需要 operationInfo,因此必须为该 getMethod 指定一个操作,以便调用正常进行。

      指定者:
      getAttribute 在接口 DynamicMBean
      参数:
      attrName - 一个字符串,指定要检索的属性的名称。它必须与 ModelMBeanAttributeInfo 的名称匹配。
      返回:
      从描述符“值”字段或从描述符的“getMethod”字段中的操作调用中检索到的属性的值。
      抛出:
      AttributeNotFoundException - 指定的属性在 MBean 中不可访问。以下情况可能会导致 AttributeNotFoundException:
      • 未找到模型 MBean 的 ModelMBeanInfo。
      • 找不到指定属性名称的 ModelMBeanAttributeInfo。
      • ModelMBeanAttributeInfo isReadable 方法返回“false”。
      MBeanException - 包装以下异常之一:
      • InvalidAttributeValueException :从属性的 getter 方法接收到错误的值类型,或者在属性的描述符中没有定义“getMethod”字段,并且不存在默认值。
      • ServiceNotFoundException :没有为属性的 getter 方法定义 ModelMBeanOperationInfo,或者没有与 ModelMBeanOperationInfo 关联的描述符,或者托管资源为空。
      • InvalidTargetObjectTypeException “targetType”字段值不是“objectReference”。
      • 托管对象的 getter 抛出的异常。
      ReflectionException - 包装在尝试调用 getter 时抛出的 Exception
      RuntimeOperationsException - 包装一个 IllegalArgumentException :参数中的属性名称为空。
      参见:
    • getAttributes

      public AttributeList  getAttributes(String [] attrNames)
      返回 ModelMBean 中几个属性的值。为传入的 attrNames 数组中的每个属性名称执行 getAttribute。
      指定者:
      getAttributes 在接口 DynamicMBean
      参数:
      attrNames - 要检索的属性名称的字符串数组。
      返回:
      检索到的属性的数组。
      抛出:
      RuntimeOperationsException - 包装一个 IllegalArgumentException :参数中的对象名称为空或参数中的属性为空。
      参见:
    • setAttribute

      设置命名 ModelMBean 的特定属性的值。如果属性描述符的“setMethod”字段包含有效操作描述符的名称,则执行操作描述符描述的方法。在此实现中,必须正确指定操作描述符并将其分配给 modelMBeanInfo,以便“setMethod”正常工作。方法的响应被设置为描述符中属性的值。

      如果 currencyTimeLimit > 0,则属性的新值缓存在属性描述符的“值”字段中,并且“lastUpdatedTimeStamp”字段设置为当前时间戳。

      如果属性描述符的持久字段不为空,则使用属性描述符的持久性策略来指导将属性存储在持久存储中。
      如果“persistPolicy”字段是:存储 MBean:

      • != "never"
      • =“总是”
      • =“更新”
      • = "onTimer" 和现在 > 'lastPersistTime' + 'persistPeriod'
      • = "NoMoreOftenThan" 和现在 > 'lastPersistTime' + 'persistPeriod'
      如果 'persistPolicy' 字段是: 不要存储 MBean:
      • =“从不”
      • = = "onTimer" && 现在 < 'lastPersistTime' + 'persistPeriod'
      • =“取消注册”
      • = = "NoMoreOftenThan" 现在 < 'lastPersistTime' + 'persistPeriod'

      Model MBean 的 ModelMBeanInfo 存储在一个文件中。

      指定者:
      setAttribute 在接口 DynamicMBean
      参数:
      attribute - 包含要设置的属性的名称和要设置的值的属性实例。
      抛出:
      AttributeNotFoundException - 指定的属性在 MBean 中不可访问。
      以下情况可能会导致 AttributeNotFoundException:
      • 未找到指定属性的 ModelMBeanAttributeInfo。
      • ModelMBeanAttributeInfo 的 isWritable 方法返回“false”。
      InvalidAttributeValueException - 没有为指定属性定义描述符。
      MBeanException - 包装以下异常之一:
      • 托管对象的设置器抛出的异常。
      • A ServiceNotFoundException 如果在属性的描述符中定义了 setMethod 字段并且托管资源为空;或者如果没有定义 setMethod 字段并且没有为该属性启用缓存。请注意,如果也没有 getMethod 字段,则会自动启用缓存。
      • InvalidTargetObjectTypeException “targetType”字段值不是“objectReference”。
      • 托管对象的 getter 抛出的异常。
      ReflectionException - 包装在尝试调用 setter 时抛出的 Exception
      RuntimeOperationsException - 包装一个 IllegalArgumentException :参数中的属性为空。
      参见:
    • setAttributes

      public AttributeList  setAttributes(AttributeList  attributes)
      设置此 ModelMBean 的属性数组的值。为列表中的每个属性执行 setAttribute() 方法。
      指定者:
      setAttributes 在接口 DynamicMBean
      参数:
      attributes - 属性列表:要设置的属性的标识及其要设置的值。
      返回:
      已设置的属性数组及其在 Attribute 实例中的新值。
      抛出:
      RuntimeOperationsException - 包装一个 IllegalArgumentException :参数中的对象名称为空或参数中的属性为空。
      参见:
    • addNotificationListener

      public void addNotificationListener(NotificationListener  listener, NotificationFilter  filter, Object  handback) throws IllegalArgumentException
      将实现 NotificationListener 接口的对象注册为监听。当通过 ModelMBean 或由 ModelMBean 发出任何通知时,将调用此对象的“handleNotification()”方法。这不包括 attributeChangeNotifications。他们必须独立注册。
      指定者:
      addNotificationListener 在接口 NotificationBroadcaster
      参数:
      listener - 将处理已注册 MBean 发出的通知的监听器对象。
      filter - 过滤器对象。如果为 null,则在处理通知之前不会执行任何过滤。
      handback - 发出通知时要与通知一起发送给监听器的上下文。
      抛出:
      IllegalArgumentException - 监听器不能为空。
      参见:
    • removeNotificationListener

      public void removeNotificationListener(NotificationListener  listener) throws ListenerNotFoundException
      从 RequiredModelMBean 中移除通知的监听。
      指定者:
      removeNotificationListener 在接口 NotificationBroadcaster
      参数:
      listener - 处理已注册 MBean 发出的通知的监听器名称。此方法将删除与此监听器相关的所有信息。
      抛出:
      ListenerNotFoundException - 监听器未在 MBean 中注册或为空。
      参见:
    • removeNotificationListener

      public void removeNotificationListener(NotificationListener  listener, NotificationFilter  filter, Object  handback) throws ListenerNotFoundException
      从接口 NotificationEmitter 复制的描述

      从此 MBean 中移除监听器。 MBean 必须具有与给定的 listenerfilterhandback 参数完全匹配的监听器。如果有多个这样的监听器,则只删除一个。

      当且仅当它们在要删除的监听器中为空时,filterhandback 参数可以为空。

      指定者:
      removeNotificationListener 在接口 NotificationEmitter
      参数:
      listener - 先前添加到此 MBean 的监听器。
      filter - 添加监听器时指定的过滤器。
      handback - 添加监听器时指定的交接。
      抛出:
      ListenerNotFoundException - 监听器未在 MBean 中注册,或者未在给定的过滤器和 handback 中注册。
    • sendNotification

      public void sendNotification(Notification  ntfyObj) throws MBeanException , RuntimeOperationsException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      发送通知,该通知作为 jmx.modelmbean.generic 通知传递给 ModelMBean 上已注册的通知监听。
      指定者:
      sendNotification 在接口 ModelMBeanNotificationBroadcaster
      参数:
      ntfyObj - 要传递给监听器对象的“handleNotification”方法的通知。
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 包装 IllegalArgumentException:传入参数的 Notification 对象为 null。
    • sendNotification

      public void sendNotification(String  ntfyText) throws MBeanException , RuntimeOperationsException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      发送一个通知,其中包含传递给 ModelMBean 上注册的通知监听的文本字符串。
      指定者:
      sendNotification 在接口 ModelMBeanNotificationBroadcaster
      参数:
      ntfyText - 要在通知中传递给监听器对象的“handleNotification”方法的文本。构造的通知将是:类型“jmx.modelmbean.generic” source this ModelMBean instance sequence 1
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 包装 IllegalArgumentException:传入参数的通知文本字符串为空。
    • getNotificationInfo

      public MBeanNotificationInfo [] getNotificationInfo()
      返回始终由 RequiredModelMBean 生成的通知数组。

      RequiredModelMBean 也可能总是发送两个额外的通知:

      • 一个带有描述符"name=GENERIC,descriptorType=notification,log=T,severity=6,displayName=jmx.modelmbean.generic"
      • 第二个是带有描述符 "name=ATTRIBUTE_CHANGE,descriptorType=notification,log=T,severity=6,displayName=jmx.attribute.change" 的标准属性更改通知
      因此,这两个通知总是添加到应用程序指定的通知中。
      指定者:
      getNotificationInfo 在接口 NotificationBroadcaster
      返回:
      MBeanNotificationInfo[]
    • addAttributeChangeNotificationListener

      public void addAttributeChangeNotificationListener(NotificationListener  inlistener, String  inAttributeName, Object  inhandback) throws MBeanException , RuntimeOperationsException , IllegalArgumentException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      将实现 NotificationListener 接口的对象注册为监听。当通过 ModelMBean 或由 ModelMBean 发出任何 attributeChangeNotification 时,将调用该对象的“handleNotification()”方法。这不包括其他通知。他们必须独立注册。将为该 attributeName 生成一个 AttributeChangeNotification。
      指定者:
      addAttributeChangeNotificationListener 在接口 ModelMBeanNotificationBroadcaster
      参数:
      inlistener - 将处理已注册 MBean 发出的通知的监听器对象。
      inAttributeName - 要为其接收更改通知的 ModelMBean 属性的名称。如果为空,则所有属性更改都将导致发出 attributeChangeNotification。
      inhandback - 发出通知时要与通知一起发送给监听器的上下文。
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 包装 IllegalArgumentException 参数中传递的属性名称不存在。
      IllegalArgumentException - 监听器不能为空。
      参见:
    • removeAttributeChangeNotificationListener

      public void removeAttributeChangeNotificationListener(NotificationListener  inlistener, String  inAttributeName) throws MBeanException , RuntimeOperationsException , ListenerNotFoundException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      从 RequiredModelMBean 中移除 attributeChangeNotifications 的监听。
      指定者:
      removeAttributeChangeNotificationListener 在接口 ModelMBeanNotificationBroadcaster
      参数:
      inlistener - 处理已注册 MBean 发出的通知的监听器名称。此方法将删除与此监听器相关的所有信息。
      inAttributeName - 监听器不再希望为其接收 attributeChangeNotifications 的属性。如果为 null,则将删除所有 attributeChangeNotifications 的监听器。
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 如果 inAttributeName 参数不对应于属性名称,则包装 IllegalArgumentException。
      ListenerNotFoundException - 监听器未在 MBean 中注册或为空。
      参见:
    • sendAttributeChangeNotification

      public void sendAttributeChangeNotification(AttributeChangeNotification  ntfyObj) throws MBeanException , RuntimeOperationsException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      发送一个 attributeChangeNotification,它被传递给 ModelMBean 上注册的 attributeChangeNotification 监听。
      指定者:
      sendAttributeChangeNotification 在接口 ModelMBeanNotificationBroadcaster
      参数:
      ntfyObj - 要传递给监听器对象的“handleNotification”方法的通知。
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 包装 IllegalArgumentException:传入参数的 AttributeChangeNotification 对象为 null。
    • sendAttributeChangeNotification

      public void sendAttributeChangeNotification(Attribute  inOldVal, Attribute  inNewVal) throws MBeanException , RuntimeOperationsException
      从接口 ModelMBeanNotificationBroadcaster 复制的描述
      将包含属性的旧值和新值的 attributeChangeNotification 发送到 ModelMBean 上已注册的 AttributeChangeNotification 监听。
      指定者:
      sendAttributeChangeNotification 在接口 ModelMBeanNotificationBroadcaster
      参数:
      inOldVal - 属性的原始值
      inNewVal - 属性
       The constructed attributeChangeNotification will be:
        type    "jmx.attribute.change"
        source   this ModelMBean instance
        sequence  1
        attributeName oldValue.getName()
        attributeType oldValue's class
        attributeOldValue oldValue.getValue()
        attributeNewValue newValue.getValue()
       
      的当前值
      抛出:
      MBeanException - 包装分布式通信异常。
      RuntimeOperationsException - 包装 IllegalArgumentException:传入参数的属性对象为 null 或参数中两个属性对象的名称不同。
    • getClassLoaderRepository

      protected ClassLoaderRepository  getClassLoaderRepository()
      返回用于执行类加载的类加载器存储库。子类可能希望重新定义此方法,以便返回应在此对象中使用的适当的ClassLoaderRepository
      返回:
      类加载器存储库。
    • preRegister

      public ObjectName  preRegister(MBeanServer  server, ObjectName  name) throws Exception
      允许 MBean 在注册到 MBean 服务之前执行它需要的任何操作。如果未指定 MBean 的名称,则 MBean 可以为其注册提供一个名称。如果引发任何异常,MBean 将不会在 MBean 服务中注册。

      为了确保 RequireModelMBean 的正确运行时语义,RequiredModelMBean 的任何重载或覆盖此方法的子类都应在其自己的 preRegister 实现中调用 super.preRegister(server, name)

      指定者:
      preRegister 在接口 MBeanRegistration
      参数:
      server - 将在其中注册 MBean 的 MBean 服务。
      name - MBean 的对象名称。如果 MBeanServer 接口中 createMBeanregisterMBean 方法之一的名称参数为空,则此名称为空。在这种情况下,此方法必须为新的 MBean 返回一个非空的 ObjectName。
      返回:
      MBean 将在其下注册的名称。该值不能为空。如果 name 参数不为 null,则它通常但不一定是返回值。
      抛出:
      Exception - 此异常将被 MBean 服务捕获并作为 MBeanRegistrationException 重新抛出。
    • postRegister

      public void postRegister(Boolean  registrationDone)
      允许 MBean 在 MBean 服务中注册后或注册失败后执行所需的任何操作。

      为了确保 RequireModelMBean 的正确运行时语义,RequiredModelMBean 的任何重载或覆盖此方法的子类都应在其自己的 postRegister 实现中调用 super.postRegister(registrationDone)

      指定者:
      postRegister 在接口 MBeanRegistration
      参数:
      registrationDone - 指示 MBean 是否已在 MBean 服务中成功注册。值 false 表示注册阶段失败。
    • preDeregister

      public void preDeregister() throws Exception
      允许 MBean 在被MBean 服务注销之前执行它需要的任何操作。

      为了确保 RequireModelMBean 的正确运行时语义,RequiredModelMBean 的任何子类重载或覆盖此方法都应在其自己的 preDeregister 实现中调用 super.preDeregister()

      指定者:
      preDeregister 在接口 MBeanRegistration
      抛出:
      Exception - 此异常将被 MBean 服务捕获并作为 MBeanRegistrationException 重新抛出。
    • postDeregister

      public void postDeregister()
      允许 MBean 在 MBean 服务中注销后执行所需的任何操作。

      为了确保 RequireModelMBean 的正确运行时语义,RequiredModelMBean 的任何子类重载或覆盖此方法都应在其自己的 postDeregister 实现中调用 super.postDeregister()

      指定者:
      postDeregister 在接口 MBeanRegistration