- java.lang.Object
 -  
      
- javax.management.modelmbean.RequiredModelMBean
 
 
-  
       
- All Implemented Interfaces:
 -  
         
DynamicMBean,MBeanRegistration,ModelMBean,ModelMBeanNotificationBroadcaster,NotificationBroadcaster,NotificationEmitter,PersistentMBean 
public class RequiredModelMBean extends Object implements ModelMBean, MBeanRegistration, NotificationEmitter
这个类是一个ModelMBean的实现。 每个JMX Agent都必须附带一个ModelMBean的适当实现,并且该类必须命名为RequiredModelMBean。希望可管理的Java资源使用MBeanServer的createMBean方法实例化RequiredModelMBean。 资源然后设置RequiredModelMBean实例的MBeanInfo和Descriptors。 通过ModelMBeanInfo为ModelMBean公开的属性和操作可以从MBean,连接器/适配器(如其他MBean)访问。 通过描述符,可以将托管应用程序中的值和方法定义并映射到ModelMBean的属性和操作。 该映射可以在XML格式的文件中定义,也可以在运行时以动态和编程方式定义。
在MBeanServer中实例化的每个RequiredModelMBean变得可管理:
其属性和操作可以通过连接到该MBeanServer的连接器/适配器进行远程访问。除非是符合JMX的MBean,否则不能在MBeanServer中注册Java对象。 通过实例化一个RequiredModelMBean,保证MBean有效的资源。 必须在每个公共方法上抛出MBeanException和RuntimeOperationsException。 这允许从分布式通信(RMI,EJB等)中包装异常
- 从以下版本开始:
 - 1.5
 
 
-  
        
       
-  
             
构造方法摘要
构造方法 Constructor 描述 RequiredModelMBean()构造一个空的ModelMBeanInfo的一个RequiredModelMBean。RequiredModelMBean(ModelMBeanInfo mbi)使用传入的ModelMBeanInfo构造一个RequiredModelMBean对象。 
-  
             
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidaddAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName, Object inhandback)注册一个实现NotificationListener接口的对象作为监听器。voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)注册一个实现NotificationListener接口的对象作为监听器。ObjectgetAttribute(String attrName)返回为此ModelMBean定义的特定属性的值。AttributeListgetAttributes(String[] attrNames)返回ModelMBean中的几个属性的值。protected ClassLoaderRepositorygetClassLoaderRepository()返回用于执行类加载的Class Loader Repository。MBeanInfogetMBeanInfo()返回此RequiredModelMBean所管理的属性,操作,构造函数和通知。MBeanNotificationInfo[]getNotificationInfo()返回始终由RequiredModelMBean生成的通知数组。Objectinvoke(String opName, Object[] opArgs, String[] sig)通过或者通过RequiredModelMBean调用方法,并返回方法执行的结果。voidload()使用在永久存储中找到的MBean数据来实例化此MBean实例。voidpostDeregister()允许MBean在MBean服务器中取消注册后执行所需的任何操作。voidpostRegister(Boolean registrationDone)允许MBean在MBean服务器中注册或注册失败后执行所需的操作。voidpreDeregister()允许MBean在MBean服务器取消注册之前执行所需的任何操作。ObjectNamepreRegister(MBeanServer server, ObjectName name)允许MBean在MBean服务器注册之前执行所需的任何操作。voidremoveAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName)从RequiredModelMBean中删除attributeChangeNotifications的侦听器。voidremoveNotificationListener(NotificationListener listener)从RequiredModelMBean中删除通知的侦听器。voidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)从这个MBean中删除一个监听器。voidsendAttributeChangeNotification(AttributeChangeNotification ntfyObj)发送一个attributeChangeNotification,该属性传递给ModelMBean上注册的attributeChangeNotification侦听器。voidsendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal)发送一个attributeChangeNotification,其中包含该属性的旧值和新值到ModelMBean上注册的AttributeChangeNotification侦听器。voidsendNotification(String ntfyText)发送一个通知,其中包含传递给ModelMBean上注册的通知侦听器的文本字符串。voidsendNotification(Notification ntfyObj)发送通知,该通知将作为jmx.modelmbean.generic通知传递给ModelMBean上的注册通知侦听器。voidsetAttribute(Attribute attribute)设置命名的ModelMBean的特定属性的值。AttributeListsetAttributes(AttributeList attributes)设置此ModelBean的属性数组的值。voidsetManagedResource(Object mr, String mr_type)设置要在此ModelMBean管理界面(MBeanInfo和Descriptors)中执行所有方法的对象的实例句柄。voidsetModelMBeanInfo(ModelMBeanInfo mbi)使用传入的ModelMBeanInfo初始化一个ModelMBean对象。voidstore()捕获此MBean实例的当前状态并将其写入持久存储。 
 -  
             
 
-  
        
       
-  
             
构造方法详细信息
-  
RequiredModelMBean
public RequiredModelMBean() throws MBeanException, RuntimeOperationsException构造一个空的ModelMBeanInfo的RequiredModelMBean。RequiredModelMBean的MBeanInfo和Descriptors可以使用
setModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo)方法进行自定义。 在RequiredModelMBean的MBeanInfo和Descriptors被自定义之后,可以向MBeanServer注册RequiredModelMBean。- 异常
 -  
              
MBeanException- 包裹分布式通信异常。 -  
              
RuntimeOperationsException- 在构建对象期间包裹一个RuntimeException。 
 
-  
RequiredModelMBean
public RequiredModelMBean(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException
使用传入的ModelMBeanInfo构造一个RequiredModelMBean对象。只要RequiredModelMBean尚未注册到MBeanServer,则可以使用setModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo)方法自定义RequiredModelMBean的MBeanInfo和Descriptors。 在RequiredModelMBean的MBeanInfo和Descriptors被自定义之后,可以向MBeanServer注册RequiredModelMBean。- 参数
 -  
              
mbi- RequiredModelMBean要使用的ModelMBeanInfo对象。 给定的ModelMBeanInfo按照setModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo)的规定被克隆和修改 - 异常
 -  
              
MBeanException- 包装分布式通信异常。 -  
              
RuntimeOperationsException- 包装{link java.lang.IllegalArgumentException}:传入参数的MBeanInfo为null。 
 
 -  
 
-  
             
方法详细信息
-  
setModelMBeanInfo
public void setModelMBeanInfo(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException
使用传入的ModelMBeanInfo初始化一个ModelMBean对象。该方法使得可以在ModelMBean上设置自定义的ModelMBeanInfo,只要它不向MBeanServer注册。
一旦ModelMBean的ModelMBeanInfo(带描述符)被自定义并在ModelMBean上设置,那么ModelMBean将被注册到MBeanServer。如果ModelMBean当前已注册,该方法将抛出一个
RuntimeOperationsException包装IllegalStateException如果给定的inModelMBeanInfo不包含
GENERIC或ATTRIBUTE_CHANGE通知的任何ModelMBeanNotificationInfo,则RequiredModelMBean将为缺少的通知提供自己的默认值ModelMBeanNotificationInfo。- Specified by:
 -  
              
setModelMBeanInfo在接口ModelMBean - 参数
 -  
              
mbi- ModelMBean要使用的ModelMBeanInfo对象。 - 异常
 -  
              
MBeanException- 包装分布式通信异常。 -  
              
RuntimeOperationsException--  如果传入参数的MBeanInfo为空,则包装一个
IllegalArgumentException。 -  如果ModelMBean当前在MBeanServer中注册,则包装一个
IllegalStateException。 
 -  如果传入参数的MBeanInfo为空,则包装一个
 
 
-  
setManagedResource
public void setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException
设置要在此ModelMBean管理界面(MBeanInfo和Descriptors)中执行所有方法的对象的实例句柄。- Specified by:
 -  
              
setManagedResource在接口ModelMBean - 参数
 -  
              
mr- 作为被管理资源的对象 -  
              
mr_type- 受管资源的引用类型。
可以是:“ObjectReference”,“Handle”,“IOR”,“EJBHandle”或“RMIReference”。
在此实现中,仅支持“ObjectReference”。 - 异常
 -  
              
MBeanException- 对象的初始化程序已抛出异常。 -  
              
InstanceNotFoundException- 找不到托管资源对象 -  
              
InvalidTargetObjectTypeException- 受管资源类型应为“ObjectReference”。 -  
              
RuntimeOperationsException- 设置资源时包裹一个RuntimeException。 
 
-  
load
public void load() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException使用在永久存储中找到的MBean数据来实例化此MBean实例。 加载的数据可以包括属性和操作值。
在此实例的构建或初始化期间,以及在MBean注册到MBeanServer之前,应该调用此方法。
如果该类的实现不支持持久性,则抛出一个包含
ServiceNotFoundException的MBeanException。- Specified by:
 -  
              
load在接口PersistentMBean - 异常
 -  
              
MBeanException- 包装另一个异常,或不支持持久性 -  
              
RuntimeOperationsException- 从持久性机制包装异常 -  
              
InstanceNotFoundException- 无法从永久存储中找到或加载该MBean 
 
-  
store
public void store() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException捕获此MBean实例的当前状态并将其写入持久存储。 存储的状态可以包括属性和操作值。
如果此类的实现不支持持久性,则抛出一个
MBeanException包装ServiceNotFoundException。使用MBean和属性描述符的持久性策略来指导该方法的执行。 如果'persistPolicy'字段为:MBean应存储
!= "never" = "always" = "onTimer" and now > 'lastPersistTime' + 'persistPeriod' = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod' = "onUnregister"如果'persistPolicy'字段为:不存储MBean:
= "never" = "onUpdate" = "onTimer" && now < 'lastPersistTime' + 'persistPeriod'- Specified by:
 -  
              
store在接口PersistentMBean - 异常
 -  
              
MBeanException- 包装另一个异常,或不支持持久性 -  
              
RuntimeOperationsException- 从持久性机制中包装异常 -  
              
InstanceNotFoundException- 找不到/访问永久存储 
 
-  
getMBeanInfo
public MBeanInfo getMBeanInfo()
返回此RequiredModelMBean所管理的属性,操作,构造函数和通知。- Specified by:
 -  
              
getMBeanInfo在接口DynamicMBean - 结果
 - ModelMBeanInfo的一个实例允许检索此MBean的所有属性,操作和通知。
 
 
-  
invoke
public Object invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException
通过或者通过RequiredModelMBean调用方法,并返回方法执行的结果。如果要调用的给定方法与所提供的签名一起匹配RequiredModelMbean可访问方法之一,则将调用该方法。 否则,将对被管理的资源进行对给定方法的调用。
操作返回的最后一个值可以缓存在ModelMBeanOperationInfo描述符中的操作描述符中。 有效值将在“值”字段中,如果有的话。 如果描述符中的'currencyTimeLimit'字段是:
- <0然后该值不缓存并且永远无效。 调用操作方法。 'value'和'lastUpdatedTimeStamp'字段被清除。
 - = 0然后值始终被缓存并且始终有效。 返回“值”字段。 如果没有'value'字段,则会为该属性调用操作方法。 'lastUpdatedTimeStamp'字段和`value'字段设置为操作的返回值和当前时间戳。
 -  > 0表示“值”字段有效的秒数。 当'lastUpdatedTimeStamp'+'currencyTimeLimit'> Now时,'值'字段不再有效。 
               
- 当'value'有效时,返回'value'。
 - 当'value'不再有效时,调用操作方法。 'lastUpdatedTimeStamp'字段和`value'字段被更新。
 
 
注意:由于本规范的先前版本不一致,建议不要对
currencyTimeLimit使用负值或零值。 要指示缓存值永远无效,请忽略currencyTimeLimit字段。 要指示它始终有效,请在此字段中使用非常大的数字。- Specified by:
 -  
              
invoke在接口DynamicMBean - 参数
 -  
              
opName- 要调用的方法的名称。 如果在操作描述符的'class'字段中定义了类名称,则该名称可以是包含类名称的完全限定方法名称,也可以是方法名称。 -  
              
opArgs- 包含在调用操作时要设置的参数的数组 -  
              
sig- 包含操作签名的数组。 将使用与用于加载调用操作的MBean相同的类加载器来加载类对象。 - 结果
 - 该方法返回的对象,表示在指定的受管资源上调用方法的结果。
 - 异常
 -  
              
MBeanException- 包含以下其中一个异常:- 被管理对象的调用方法抛出的异常。
 -  
ServiceNotFoundException:否ModelMBeanOperationInfo或没有为指定操作定义的描述符或被管理资源为空。 -  
InvalidTargetObjectTypeException:'targetType'字段值不是'objectReference'。 
 -  
              
ReflectionException- 在尝试调用该方法时抛出一个异常。 -  
              
RuntimeOperationsException- 包装IllegalArgumentException方法名称为null。 
 
-  
getAttribute
public Object getAttribute(String attrName) throws AttributeNotFoundException, MBeanException, ReflectionException
返回为此ModelMBean定义的特定属性的值。 属性返回的最后一个值可以缓存在属性的描述符中。 有效值将在“值”字段中,如果有的话。 如果描述符中的'currencyTimeLimit'字段是:- <0然后该值不缓存并且永远无效。 为属性调用getter方法。 'value'和'lastUpdatedTimeStamp'字段被清除。
 - = 0然后值始终被缓存并且始终有效。 返回“值”字段。 如果没有'value'字段,那么为该属性调用getter方法。 'lastUpdatedTimeStamp'字段和'value'字段设置为属性的值和当前时间戳。
 -  > 0表示“值”字段有效的秒数。 当'lastUpdatedTimeStamp'+'currencyTimeLimit'> Now时,'值'字段不再有效。 
               
- 当'value'有效时,返回'value'。
 - 当“值”不再有效时,该属性将调用getter方法。 'lastUpdatedTimeStamp'字段和`value'字段被更新。
 
 
注意:由于本规范的先前版本不一致,建议不要对
currencyTimeLimit使用负值或零值。 要指示缓存值永远无效,请忽略currencyTimeLimit字段。 要指示它始终有效,请在此字段中使用非常大的数字。如果“getMethod”字段包含有效的操作描述符的名称,则执行操作描述符描述的方法。 该方法的响应作为属性的值返回。 如果操作失败或返回的值与声明的属性类型不兼容,将抛出异常。
如果没有定义“getMethod”字段,则返回属性的默认值。 如果返回的值与声明的属性类型不兼容,将抛出异常。
属性的声明类型是由
MBeanAttributeInfo.getType()返回的字符串 。 如果满足以下条件之一,则该值与此类型兼容:- 该值为null;
 - 声明的名称是一个原始类型名称(如“int”),该值是相应包装器类型的实例(如java.lang.Integer);
 - 该值的名称与声明的名称相同;
 - 声明的名称可以由值的类加载器加载,并生成可以分配该值的类。
 
在这个实现中,在需要调用getMethod的每一种情况下,由于通过标准的“invoke”方法调用该方法,因此需要使用operationInfo,因此必须为该getMethod指定一个操作,以便调用工作正常。
- Specified by:
 -  
              
getAttribute在接口DynamicMBean - 参数
 -  
              
attrName- 指定要检索的属性名称的字符串。 它必须匹配ModelMBeanAttributeInfo的名称。 - 结果
 - 从描述符'value'字段检索属性的值,或从描述符的'getMethod'字段中的操作的调用。
 - 异常
 -  
              
AttributeNotFoundException- MBean中无法访问指定的属性。 以下情况可能会导致AttributeNotFoundException:- 没有为Model MBean找到ModelMBeanInfo。
 - 没有找到指定的属性名称的ModelMBeanAttributeInfo。
 - ModelMBeanAttributeInfo isReadable方法返回'false'。
 
 -  
              
MBeanException- 包装以下其中一个异常:-  
InvalidAttributeValueException:从属性的getter方法接收到错误的值类型,或者在该属性的描述符中定义的没有'getMethod'字段,并且没有默认值存在。 -  
ServiceNotFoundException:没有为属性的getter方法定义的ModelMBeanOperationInfo或与ModelMBeanOperationInfo或被管理资源关联的描述符为null。 -  
InvalidTargetObjectTypeException'targetType '字段值不是'objectReference'。 - 被管理对象的getter抛出的异常。
 
 -  
 -  
              
ReflectionException- 包裹一个异常在尝试调用吸气剂时抛出。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException:参数中的属性名称为null。 - 另请参见:
 -  
              
setAttribute(javax.management.Attribute) 
 
-  
getAttributes
public AttributeList getAttributes(String[] attrNames)
返回ModelMBean中的几个属性的值。 对传入的attrNames数组中的每个属性名执行getAttribute。- Specified by:
 -  
              
getAttributes在接口DynamicMBean - 参数
 -  
              
attrNames- 要检索的属性名称的String数组。 - 结果
 - 检索属性的数组。
 - 异常
 -  
              
RuntimeOperationsException- 包装IllegalArgumentException:参数中的对象名称为null或参数中的属性为null。 - 另请参见:
 -  
              
setAttributes(javax.management.AttributeList) 
 
-  
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
设置命名的ModelMBean的特定属性的值。 如果属性描述符的“setMethod”字段包含有效的操作描述符的名称,则执行操作描述符描述的方法。 在此实现中,必须正确指定操作描述符并分配给modelMBeanInfo,以使“setMethod”正常工作。 该方法的响应被设置为描述符中属性的值。如果currencyTimeLimit> 0,则属性描述符的'value'字段中缓存属性的新值,并将'lastUpdatedTimeStamp'字段设置为当前时间戳。
如果属性描述符的持久字段不为空,则使用属性描述符的持久性策略来指导将属性存储在持久存储中。
如果'persistPolicy'字段是存储MBean:- !=“从不”
 - =“永远”
 - =“onUpdate”
 - =“onTimer”,现在>'lastPersistTime'+'persistPeriod'
 - =“NoMoreOftenThan”,现在>'lastPersistTime'+'persistPeriod'
 
- =“从不”
 - = =“onTimer”&& now <'lastPersistTime'+'persistPeriod'
 - =“onUnregister”
 - = =“NoMoreOftenThan”,现在<'lastPersistTime'+'persistPeriod'
 
模型MBean的ModelMBeanInfo存储在一个文件中。
- Specified by:
 -  
              
setAttribute在接口DynamicMBean - 参数
 -  
              
attribute- 包含要设置的属性的名称和要设置的值的属性实例。 - 异常
 -  
              
AttributeNotFoundException- MBean中无法访问指定的属性。
以下情况可能会导致AttributeNotFoundException:- 没有找到指定属性的ModelMBeanAttributeInfo。
 - ModelMBeanAttributeInfo的isWritable方法返回'false'。
 
 -  
              
InvalidAttributeValueException- 没有为指定的属性定义描述符。 -  
              
MBeanException- 包装以下其中一个异常:- 被管理对象的setter抛出的异常。
 -  A 
ServiceNotFoundException如果在属性的描述符中定义了setMethod字段,并且被管理资源为null; 或者如果没有定义setMethod字段,并且没有为该属性启用缓存。 请注意,如果没有getMethod字段,则会自动启用缓存。 -  
InvalidTargetObjectTypeException'targetType '字段值不是'objectReference'。 - 被管理对象的getter抛出的异常。
 
 -  
              
ReflectionException- 在尝试调用设置器时抛出一个异常。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException:参数中的属性为null。 - 另请参见:
 -  
              
getAttribute(java.lang.String) 
 
-  
setAttributes
public AttributeList setAttributes(AttributeList attributes)
设置此ModelBean的属性数组的值。 对列表中的每个属性执行setAttribute()方法。- Specified by:
 -  
              
setAttributes在接口DynamicMBean - 参数
 -  
              
attributes- 属性列表:要设置的属性的标识以及要设置的属性值。 - 结果
 - 已设置的属性数组,其属性实例中的新值。
 - 异常
 -  
              
RuntimeOperationsException- 包装IllegalArgumentException:参数中的对象名称为空,或参数中的属性为空。 - 另请参见:
 -  
              
getAttributes(java.lang.String[]) 
 
-  
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException
注册一个实现NotificationListener接口的对象作为监听器。 当通过或通过ModelMBean发出通知时,将调用此对象的'handleNotification()'方法。 这不包括attributeChangeNotifications。 他们必须独立注册。- Specified by:
 -  
              
addNotificationListener在接口NotificationBroadcaster - 参数
 -  
              
listener- 将处理由注册的MBean发出的通知的侦听器对象。 -  
              
filter- 过滤器对象。 如果为空,则在处理通知之前不会执行过滤。 -  
              
handback- 发出通知时发送给侦听器的上下文通知。 - 异常
 -  
              
IllegalArgumentException- 侦听器不能为空。 - 另请参见:
 -  
              
removeNotificationListener(javax.management.NotificationListener) 
 
-  
removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
从RequiredModelMBean中删除通知的侦听器。- Specified by:
 -  
              
removeNotificationListener在接口NotificationBroadcaster - 参数
 -  
              
listener- 处理注册MBean发出的通知的侦听器名称。 此方法将删除与此侦听器相关的所有信息。 - 异常
 -  
              
ListenerNotFoundException- 监听器未在MBean中注册或为空。 - 另请参见:
 -  
              
addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object) 
 
-  
removeNotificationListener
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
描述从接口NotificationEmitter复制从这个MBean中删除一个监听器。 该MBean必须有一个与给定匹配的侦听
listener,filter,并handback参数。 如果有多个这样的听众,只有一个被删除。如果且仅当在要删除的侦听器中为空时,
filter和handback参数可能为空。- Specified by:
 -  
              
removeNotificationListener在接口NotificationEmitter - 参数
 -  
              
listener- 以前添加到此MBean的侦听器。 -  
              
filter- 添加侦听器时指定的过滤器。 -  
              
handback- 添加侦听器时指定的handback。 - 异常
 -  
              
ListenerNotFoundException- 监听器未注册到MBean,或者没有向给定的过滤器和回传注册。 
 
-  
sendNotification
public void sendNotification(Notification ntfyObj) throws MBeanException, RuntimeOperationsException
发送通知,该通知将作为jmx.modelmbean.generic通知传递给ModelMBean上的注册通知侦听器。- Specified by:
 -  
              
sendNotification在接口ModelMBeanNotificationBroadcaster - 参数
 -  
              
ntfyObj- 要传递给侦听器对象的“handleNotification”方法的通知。 - 异常
 -  
              
MBeanException- 包裹分布式通信异常。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException:在参数中传递的Notification对象为null。 
 
-  
sendNotification
public void sendNotification(String ntfyText) throws MBeanException, RuntimeOperationsException
发送一个通知,其中包含传递给ModelMBean上注册的通知侦听器的文本字符串。- Specified by:
 -  
              
sendNotification在接口ModelMBeanNotificationBroadcaster - 参数
 -  
              
ntfyText- 要在通知中传递给侦听器对象的“handleNotification”方法的文本。 构造的通知将是:键入“jmx.modelmbean.generic”源此ModelMBean实例序列1 - 异常
 -  
              
MBeanException- 包装分布式通信异常。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException:参数中传递的Notification文本字符串为null。 
 
-  
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"的标准属性更改通知 
- Specified by:
 -  
              
getNotificationInfo在接口NotificationBroadcaster - 结果
 - 的MBeanNotificationInfo []
 
 -  一个与描述符
 
-  
addAttributeChangeNotificationListener
public void addAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName, Object inhandback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException
注册一个实现NotificationListener接口的对象作为监听器。 当通过或通过ModelMBean发出任何attributeChangeNotification时,将调用此对象的'handleNotification()'方法。 这不包括其他通知。 他们必须独立注册。 将为此attributeName生成AttributeChangeNotification。- Specified by:
 -  
              
addAttributeChangeNotificationListener在接口ModelMBeanNotificationBroadcaster - 参数
 -  
              
inlistener- 将处理由注册的MBean发出的通知的侦听器对象。 -  
              
inAttributeName- 要接收更改通知的ModelMBean属性的名称。 如果为null,则所有属性更改将导致发出attributeChangeNotification。 -  
              
inhandback- 发送通知时发送给侦听器的上下文通知。 - 异常
 -  
              
MBeanException- 包装分布式通信异常。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException参数中传递的属性名称不存在。 -  
              
IllegalArgumentException- 侦听器不能为空。 - 另请参见:
 -  
              
ModelMBeanNotificationBroadcaster.removeAttributeChangeNotificationListener(javax.management.NotificationListener, java.lang.String) 
 
-  
removeAttributeChangeNotificationListener
public void removeAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName) throws MBeanException, RuntimeOperationsException, ListenerNotFoundException
从RequiredModelMBean中删除attributeChangeNotifications的侦听器。- Specified by:
 -  
              
removeAttributeChangeNotificationListener在接口ModelMBeanNotificationBroadcaster - 参数
 -  
              
inlistener- 处理由注册MBean发出的通知的侦听器名称。 此方法将删除与此侦听器相关的所有信息。 -  
              
inAttributeName- 侦听器不再需要接收attributeChangeNotifications的属性。 如果为null,则将为所有attributeChangeNotifications移除侦听器。 - 异常
 -  
              
MBeanException- 包装分布式通信异常。 -  
              
RuntimeOperationsException- 包装IllegalArgumentException如果inAttributeName参数与属性名称不对应。 -  
              
ListenerNotFoundException- 监听器未在MBean中注册或为空。 - 另请参见:
 -  
              
ModelMBeanNotificationBroadcaster.addAttributeChangeNotificationListener(javax.management.NotificationListener, java.lang.String, java.lang.Object) 
 
-  
sendAttributeChangeNotification
public void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj) throws MBeanException, RuntimeOperationsException
说明从界面:ModelMBeanNotificationBroadcaster复制发送一个attributeChangeNotification,该属性传递给ModelMBean上注册的attributeChangeNotification侦听器。- Specified by:
 -  
              
sendAttributeChangeNotification在接口ModelMBeanNotificationBroadcaster - 参数
 -  
              
ntfyObj- 要传递给侦听器对象的“handleNotification”方法的通知。 - 异常
 -  
              
MBeanException- 包裹分布式通信异常。 -  
              
RuntimeOperationsException- 包裹一个IllegalArgumentException:参数中传递的AttributeChangeNotification对象为null。 
 
-  
sendAttributeChangeNotification
public void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException
发送一个attributeChangeNotification,其中包含该属性的旧值和新值到ModelMBean上注册的AttributeChangeNotification侦听器。- Specified by:
 -  
              
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或参数中两个Attribute对象的名称不相同。 
 
-  
getClassLoaderRepository
protected ClassLoaderRepository getClassLoaderRepository()
返回用于执行类加载的Class Loader Repository。 子类可能希望重新定义此方法,以返回应在此对象中使用的适当的ClassLoaderRepository。- 结果
 - Class Loader Repository。
 
 
-  
preRegister
public ObjectName preRegister(MBeanServer server, ObjectName name) throws 异常
允许MBean在MBean服务器注册之前执行所需的任何操作。 如果未指定MBean的名称,则MBean可以为其注册提供一个名称。 如果引发异常,MBean将不会在MBean服务器中注册。为了确保RequireModelMBean的正确运行时语义,RequiredModelMBean的
super.preRegister(server, name)类重载或覆盖此方法都应在其自身的preRegister调用super.preRegister(server, name)。- Specified by:
 -  
              
preRegister在接口MBeanRegistration - 参数
 -  
              
server- MBean将在其中注册的MBean服务器。 -  
              
name- MBean的对象名称。 此名称为null如果名称参数的一个createMBean或者registerMBean方法在MBeanServer接口为空。 在这种情况下,此方法必须为新的MBean返回非空的ObjectName。 - 结果
 -  
              要注册MBean的名称。 
              此值不能为空。 
              如果
name参数不为空,则通常不一定是返回值。 - 异常
 -  
              
异常- 此异常将被MBean服务器捕获,并重新抛出为MBeanRegistrationException。 
 
-  
postRegister
public void postRegister(Boolean registrationDone)
允许MBean在MBean服务器中注册或注册失败后执行所需的操作。为了确保RequireModelMBean的正确运行时语义,RequiredModelMBean的
super.postRegister(registrationDone)类重载或覆盖此方法都应在其自身的postRegister调用super.postRegister(registrationDone)。- Specified by:
 -  
              
postRegister在接口MBeanRegistration - 参数
 -  
              
registrationDone- 指示MBean是否已在MBean服务器中成功注册。 值false表示注册阶段失败。 
 
-  
preDeregister
public void preDeregister() throws 异常允许MBean在MBean服务器取消注册之前执行所需的任何操作。为了确保RequireModelMBean的正确运行时语义,RequiredModelMBean的
super.preDeregister()类重载或覆盖此方法都应在其自身的preDeregister调用super.preDeregister()。- Specified by:
 -  
              
preDeregister在接口MBeanRegistration - 异常
 -  
              
异常- 此异常将被MBean服务器捕获,并重新抛出为MBeanRegistrationException。 
 
-  
postDeregister
public void postDeregister()
允许MBean在MBean服务器中取消注册后执行所需的任何操作。为了确保RequireModelMBean的正确的运行时语义,RequiredModelMBean的
super.postDeregister()类重载或覆盖此方法都应在其自身的postDeregister调用super.postDeregister()。- Specified by:
 -  
              
postDeregister在接口MBeanRegistration 
 
 -  
 
 -