public class StandardEmitterMBean extends StandardMBean implements NotificationEmitter
MBean的管理界面是通过一个java界面反射测定,并发出通知。
下面的示例演示如何使用公共构造函数StandardEmitterMBean(implementation, mbeanInterface, emitter)
创建一个MBean的任何实现类的名字实现发出通知,提供一个管理接口定义(如电流标准MBean)通过任何接口intF、与任何实现的接口NotificationEmitter
。该示例使用类NotificationBroadcasterSupport
为接口NotificationEmitter
实现。
MBeanServer MBS;…[ [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [;最后mbeannotificationinfo信息=新MBeanNotificationInfo(类型,getname()通知。类,“关于光盘信息的通知。”;最后notificationemitter发射器=新的notificationbroadcastersupport(信息);最终实现=新intF实现(…);最终目标MBean =新standardemittermbean(实现,Intf.class,发射器);住房抵押贷款证券化。registermbean(MBean,对象);
StandardMBean
Modifier | Constructor and Description |
---|---|
protected |
StandardEmitterMBean(类<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
做为管理MBean接口指定的
mbeanInterface ,并在通知了
NotificationEmitter 处理。
|
protected |
StandardEmitterMBean(类<?> mbeanInterface, NotificationEmitter emitter)
做为管理MBean接口指定的
mbeanInterface ,并在通知了
NotificationEmitter 处理。
|
|
StandardEmitterMBean(T implementation, 类<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
做为管理MBean接口指定的
mbeanInterface ,与给定的实施,通知了
NotificationEmitter 处理。
|
|
StandardEmitterMBean(T implementation, 类<T> mbeanInterface, NotificationEmitter emitter)
做为管理MBean接口指定的
mbeanInterface ,与给定的实施,通知了
NotificationEmitter 处理。
|
Modifier and Type | Method and Description |
---|---|
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)
发送通知。
|
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
public StandardEmitterMBean(T implementation, 类<T> mbeanInterface, NotificationEmitter emitter)
做为管理MBean接口指定的mbeanInterface
,与给定的实施,通知了NotificationEmitter
处理。结果通过转发的方法emitter
MBean实现NotificationEmitter
接口。对于implementation
和emitter
是相同的对象,它是合法的,有用的。
如果emitter
实例NotificationBroadcasterSupport
然后MBean的sendNotification
方法将调用emitter.
sendNotification
。
返回的数组getNotificationInfo()
在新的MBean是一份返回的数组emitter.
getNotificationInfo()
施工时。如果数组的变化emitter.getNotificationInfo()
后返回,那将没有对该对象的getNotificationInfo()
。
implementation
的MBean接口的实现。
mbeanInterface
-标准MBean接口。
emitter
-将处理通知的对象。
IllegalArgumentException
-如果
mbeanInterface
不遵循JMX管理接口的设计模式,或者给
implementation
没有实现指定的接口,或者
emitter
是空的。
public StandardEmitterMBean(T implementation, 类<T> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
做为管理MBean接口指定的mbeanInterface
,与给定的实施,通知了NotificationEmitter
处理。此构造函数可以用来做标准MBean或mxbeans。结果通过转发的方法emitter
MBean实现NotificationEmitter
接口。对于implementation
和emitter
是相同的对象,它是合法的,有用的。
如果emitter
实例NotificationBroadcasterSupport
然后MBean的sendNotification
方法将调用emitter.
sendNotification
。
返回的数组getNotificationInfo()
在新的MBean是一份返回的数组emitter.
getNotificationInfo()
施工时。如果数组的变化emitter.getNotificationInfo()
后返回,那将没有对该对象的getNotificationInfo()
。
implementation
的MBean接口的实现。
mbeanInterface
-标准MBean接口。
isMXBean
-如果真的
mbeanInterface
参数名称的MXBean接口和所得的MBean的MXBean。
emitter
-将处理通知的对象。
IllegalArgumentException
-如果
mbeanInterface
不遵循JMX管理接口的设计模式,或者给
implementation
没有实现指定的接口,或者
emitter
是空的。
protected StandardEmitterMBean(类<?> mbeanInterface, NotificationEmitter emitter)
做为管理MBean接口指定的mbeanInterface
,并在通知了NotificationEmitter
处理。结果通过转发的方法emitter
MBean实现NotificationEmitter
接口。
如果emitter
实例NotificationBroadcasterSupport
然后MBean的sendNotification
方法将调用emitter.
sendNotification
。
返回的数组getNotificationInfo()
在新的MBean是一份返回的数组emitter.
getNotificationInfo()
施工时。如果emitter.getNotificationInfo()
后来改变返回的数组,将不会影响该对象的getNotificationInfo()
。
此构造函数必须调用子类的实现给定的mbeanInterface
。
mbeanInterface
- standardmbean接口。
emitter
-将处理通知的对象。
IllegalArgumentException
-如果
mbeanInterface
不遵循JMX管理接口的设计模式,或者如果
this
没有实现指定的接口,或者
emitter
是空的。
protected StandardEmitterMBean(类<?> mbeanInterface, boolean isMXBean, NotificationEmitter emitter)
做为管理MBean接口指定的mbeanInterface
,并在通知了NotificationEmitter
处理。此构造函数可以用来做标准MBean或mxbeans。结果通过转发的方法emitter
MBean实现NotificationEmitter
接口。
如果emitter
实例NotificationBroadcasterSupport
然后MBean的sendNotification
方法将调用emitter.
sendNotification
。
返回的数组getNotificationInfo()
在新的MBean是一份返回的数组emitter.
getNotificationInfo()
施工时。如果emitter.getNotificationInfo()
后来改变返回的数组,将不会影响该对象的getNotificationInfo()
。
此构造函数必须调用子类的实现给定的mbeanInterface
。
mbeanInterface
- standardmbean接口。
isMXBean
-如果真的
mbeanInterface
参数名称的MXBean接口和所得的MBean的MXBean。
emitter
-将处理通知的对象。
IllegalArgumentException
-如果
mbeanInterface
不遵循JMX管理接口的设计模式,或者如果
this
没有实现指定的接口,或者
emitter
是空的。
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
NotificationBroadcaster
removeNotificationListener
接口
NotificationBroadcaster
listener
-听者以前添加到这个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,如果他们在听众被删除是空的。
removeNotificationListener
接口
NotificationEmitter
listener
-听者以前添加到这个MBean。
filter
-过滤器,当你添加指定的。
handback
-盖印,指定当听众加入。
ListenerNotFoundException
-听者不是MBean注册,或不与给定的滤波器和盖印注册。
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
NotificationBroadcaster
addNotificationListener
接口
NotificationBroadcaster
listener
-监听器对象将处理由电视台发出的通知。
filter
-滤波对象。如果过滤器为空,则在处理通知之前没有进行过滤。
handback
-一个不透明的物体被送回听者当通知发出。此对象不能被通知广播对象使用。它应该是怨恨与通知的通知不变。
NotificationBroadcaster.removeNotificationListener(javax.management.NotificationListener)
public MBeanNotificationInfo[] getNotificationInfo()
NotificationBroadcaster
返回一个数组表示,每个通知MBean可能发送的通知和通知类型的java类的名称。
对于MBean发送该数组中没有描述的通知不违法。然而,这个MBean服务器的一些客户可能取决于阵列完成其正确运作。
getNotificationInfo
接口
NotificationBroadcaster
public void sendNotification(Notification n)
发送通知。
如果构造函数的参数是emitter
NotificationBroadcasterSupport
那么方法实例将emitter.
sendNotification
。
n
-通知发送。
ClassCastException
如果构造函数的参数不是一个
NotificationBroadcasterSupport
emitter
。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.