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