|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.management.StandardMBean
javax.management.StandardEmitterMBean
public class StandardEmitterMBean
一个其管理接口由 Java 接口上的反射确定并且可以发送通知的 MBean。
以下示例显示了如何使用公共构造方法 StandardEmitterMBean(implementation, mbeanInterface, emitter) 创建一个 MBean,使之能使用实现类名称 Impl、接口 Intf(对于当前标准 MBean)定义的管理接口,以及接口 NotificationEmitter 的实现来发送消息。该示例使用类 NotificationBroadcasterSupport 作为接口 NotificationEmitter 的实现。
MBeanServer mbs;
...
final String[] types = new String[] {"sun.disc.space","sun.disc.alarm"};
final MBeanNotificationInfo info = new MBeanNotificationInfo(
types,
Notification.class.getName(),
"Notification about disc info.");
final NotificationEmitter emitter =
new NotificationBroadcasterSupport(info);
final Intf impl = new Impl(...);
final Object mbean = new StandardEmitterMBean(
impl, Intf.class, emitter);
mbs.registerMBean(mbean, objectName);
StandardMBean| 构造方法摘要 | |
|---|---|
protected |
StandardEmitterMBean(Class<?> mbeanInterface,
boolean isMXBean,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 指定,并且其中的通知由给定的 NotificationEmitter 处理。 |
protected |
StandardEmitterMBean(Class<?> mbeanInterface,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 指定,并且其中的通知由给定的 NotificationEmitter 处理。 |
|
StandardEmitterMBean(T implementation,
Class<T> mbeanInterface,
boolean isMXBean,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 使用给定实现指定,并且其中的通知由给定的 NotificationEmitter 处理。 |
|
StandardEmitterMBean(T implementation,
Class<T> mbeanInterface,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 使用给定实现指定,并且其中的通知由给定的 NotificationEmitter 处理。 |
| 方法摘要 | |
|---|---|
void |
addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
在此 MBean 中添加一个侦听器。 |
MBeanNotificationInfo[] |
getNotificationInfo()
返回一个数组,指示此 MBean 可能发送的每个通知的 Java 类名和通知类型。 |
void |
removeNotificationListener(NotificationListener listener)
从此 MBean 移除一个侦听器。 |
void |
removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
从此 MBean 移除一个侦听器。 |
void |
sendNotification(Notification n)
发送通知。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public StandardEmitterMBean(T implementation,
Class<T> mbeanInterface,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 使用给定实现指定,并且其中的通知由给定的 NotificationEmitter 处理。结果 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。这是合法的,并且在将 implementation 和 emitter 用于相同对象时很有用。
如果 emitter 是 NotificationBroadcasterSupport 的实例,则该 MBean 的 sendNotification 方法将调用 emitter.sendNotification。
由新 MBean 上的 getNotificationInfo() 返回的数组是进行构造时由 emitter.getNotificationInfo() 返回的数组的副本。如果由 emitter.getNotificationInfo() 返回的数组之后发生变化,那么这种变化不会影响到此对象的 getNotificationInfo()。
implementation - MBean 接口的实现。mbeanInterface - Standard MBean 接口。emitter - 将处理通知的对象。
IllegalArgumentException - 如果 mbeanInterface 不遵守管理接口的 JMX 设计模式,或者给定的 implementation 没有实现指定的接口,抑或 emitter 为 null。
public StandardEmitterMBean(T implementation,
Class<T> mbeanInterface,
boolean isMXBean,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 使用给定实现指定,并且其中的通知由给定的 NotificationEmitter 处理。此构造方法可以用于构造 Standard MBean 或 MXBean。结果 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。这是合法的,并且在将 implementation 和 emitter 用于相同对象时很有用。
如果 emitter 是 NotificationBroadcasterSupport 的实例,则该 MBean 的 sendNotification 方法将调用 emitter.sendNotification。
由新 MBean 上的 getNotificationInfo() 返回的数组是进行构造时由 emitter.getNotificationInfo() 返回的数组的副本。如果由 emitter.getNotificationInfo() 返回的数组之后发生变化,那么这种变化不会影响到此对象的 getNotificationInfo()。
implementation - MBean 接口的实现。mbeanInterface - Standard MBean 接口。isMXBean - 如果为 true,则 mbeanInterface 参数会对 MXBean 接口进行命名,并且结果 MBean 是一个 MXBean。emitter - 将处理通知的对象。
IllegalArgumentException - 如果 mbeanInterface 不遵守管理接口的 JMX 设计模式,或者给定的 implementation 没有实现指定的接口,抑或 emitter 为 null。
protected StandardEmitterMBean(Class<?> mbeanInterface,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 指定,并且其中的通知由给定的 NotificationEmitter 处理。结果 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。
如果 emitter 是 NotificationBroadcasterSupport 的实例,则该 MBean 的 sendNotification 方法将调用 emitter.sendNotification。
由新 MBean 上的 getNotificationInfo() 返回的数组是进行构造时由 emitter.getNotificationInfo() 返回的数组的副本。如果由 emitter.getNotificationInfo() 返回的数组之后发生变化,那么这种变化不会影响到此对象的 getNotificationInfo()。
此构造方法必须从实现给定 mbeanInterface 的子类调用。
mbeanInterface - StandardMBean 接口。emitter - 将处理通知的对象。
IllegalArgumentException - 如果 mbeanInterface 不遵守管理接口的 JMX 设计模式,或者给定的 this 没有实现指定的接口,抑或 emitter 为 null。
protected StandardEmitterMBean(Class<?> mbeanInterface,
boolean isMXBean,
NotificationEmitter emitter)
构造一个 MBean,其管理接口由 mbeanInterface 指定,并且其中的通知由给定的 NotificationEmitter 处理。此构造方法可以用于构造 Standard MBean 或 MXBean。结果 MBean 通过将其方法转发给 emitter 来实现 NotificationEmitter 接口。
如果 emitter 是 NotificationBroadcasterSupport 的实例,则该 MBean 的 sendNotification 方法将调用 emitter.sendNotification。
由新 MBean 上的 getNotificationInfo() 返回的数组是进行构造时由 emitter.getNotificationInfo() 返回的数组的副本。如果由 emitter.getNotificationInfo() 返回的数组之后发生变化,那么这种变化不会影响到此对象的 getNotificationInfo()。
此构造方法必须从实现给定 mbeanInterface 的子类调用。
mbeanInterface - StandardMBean 接口。isMXBean - 如果为 true,则 mbeanInterface 参数会对 MXBean 接口进行命名,并且结果 MBean 是一个 MXBean。emitter - 将处理通知的对象。
IllegalArgumentException - 如果 mbeanInterface 不遵守管理接口的 JMX 设计模式,或者给定的 this 没有实现指定的接口,抑或 emitter 为 null。| 方法详细信息 |
|---|
public void removeNotificationListener(NotificationListener listener)
throws ListenerNotFoundException
NotificationBroadcaster 复制的描述
NotificationBroadcaster 中的 removeNotificationListenerlistener - 以前添加到此 MBean 中的侦听器。
ListenerNotFoundException - 如果没有在 MBean 中注册该侦听器。NotificationBroadcaster.addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object),
NotificationEmitter.removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void removeNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
throws ListenerNotFoundException
NotificationEmitter 复制的描述从此 MBean 移除一个侦听器。该 MBean 必须有一个与给定 listener、filter 和 handback 参数完全匹配的侦听器。如果有多个此类侦听器,则只移除一个侦听器。
当且仅当在要移除的侦听器中 filter 和 handback 参数为 null 时,这两个参数才可以为 null。
NotificationEmitter 中的 removeNotificationListenerlistener - 以前添加到此 MBean 中的侦听器。filter - 添加侦听器时指定的过滤器。handback - 添加侦听器时指定的回送。
ListenerNotFoundException - 如果没有在该 MBean 中注册侦听器,或者没有用给定的过滤器和回送注册它。
public void addNotificationListener(NotificationListener listener,
NotificationFilter filter,
Object handback)
NotificationBroadcaster 复制的描述
NotificationBroadcaster 中的 addNotificationListenerlistener - 将处理广播者发出的通知的侦听器对象。filter - 过滤器对象。如果 filter 为 null,则处理通知前不执行过滤。handback - 发出通知时要发送回侦听器的不透明对象。Notification 广播者对象不能使用此对象。应该将通知不作更改地重新发送到侦听器。NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)public MBeanNotificationInfo[] getNotificationInfo()
NotificationBroadcaster 复制的描述返回一个数组,指示此 MBean 可能发送的每个通知的 Java 类名和通知类型。
MBean 发送此数组中未描述的通知是合法的。但是,某些 MBean 服务器的客户端要想正常运行,可能要依赖完整的数组。
NotificationBroadcaster 中的 getNotificationInfopublic void sendNotification(Notification n)
发送通知。
如果构造方法的 emitter 参数是一个 NotificationBroadcasterSupport 实例,则此方法将调用 emitter.sendNotification。
n - 要发送的通知。
ClassCastException - 如果构造方法的 emitter 参数不是 NotificationBroadcasterSupport。
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。