|
Spec-Zone .ru
спецификации, руководства, описания, API
|
|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.namespace.VirtualEventManager
public class VirtualEventManager extends Object implements EventConsumer
This class maintains a list of subscribers for ObjectName patterns and
allows a notification to be sent to all subscribers for a given ObjectName.
It is typically used in conjunction with MBeanServerSupport
to implement a namespace with Virtual MBeans that can emit notifications.
The VirtualEventManager keeps track of the listeners that have been
added to each Virtual MBean. When an event occurs that should trigger a
notification from a Virtual MBean, the publish method can
be used to send it to the appropriate listeners.
| Constructor and Description |
|---|
VirtualEventManager()
Create a new VirtualEventManager. |
| Modifier and Type | Method and Description |
|---|---|
NotificationEmitter |
getNotificationEmitterFor(ObjectName name)
Returns a NotificationEmitter object which can be used to
subscribe or unsubscribe for notifications with the named
mbean. |
void |
publish(ObjectName emitterName,
Notification n)
Sends a notification to the subscribers for a given MBean. |
void |
subscribe(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Subscribes a listener to receive events from an MBean or a set of MBeans represented by an ObjectName pattern. |
void |
unsubscribe(ObjectName name,
NotificationListener listener)
Unsubscribes a listener which is listening to an MBean or a set of MBeans represented by an ObjectName pattern. |
void |
unsubscribe(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
Unsubscribes a listener which is listening to an MBean or a set of MBeans represented by an ObjectName pattern. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VirtualEventManager()
Create a new VirtualEventManager.
| Method Detail |
|---|
public void subscribe(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
EventConsumerSubscribes a listener to receive events from an MBean or a set
of MBeans represented by an ObjectName pattern.
An event emitted by an MBean is forwarded to every listener that was subscribed with the name of that MBean, or with a pattern that matches that name.
subscribe in interface EventConsumername - The name of an MBean or an ObjectName pattern
representing a set of MBeans to which the listener should listen.listener - The listener object that will handle the
notifications emitted by the MBeans.filter - The filter object. If filter is null, no
filtering will be performed before notification handling.handback - The context to be sent to the listener when a
notification is emitted.EventConsumer.unsubscribe(ObjectName, NotificationListener)
public void unsubscribe(ObjectName name,
NotificationListener listener)
throws ListenerNotFoundException
EventConsumerUnsubscribes a listener which is listening to an MBean or a set of
MBeans represented by an ObjectName pattern.
The listener to be removed must have been added by the subscribe method with the given name. If the name is a pattern, then the subscribe must have used the same
pattern. If the same listener has been subscribed more than once to the
name, perhaps with different filters or handbacks, then all such
listeners are removed.
unsubscribe in interface EventConsumername - The name of the MBean or an ObjectName pattern
representing a set of MBeans to which the listener was subscribed.listener - A listener that was previously subscribed to the
MBean(s).ListenerNotFoundException - The given listener was not
subscribed to the given name.EventConsumer.subscribe(javax.management.ObjectName, javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void unsubscribe(ObjectName name,
NotificationListener listener,
NotificationFilter filter,
Object handback)
throws ListenerNotFoundException
Unsubscribes a listener which is listening to an MBean or a set of
MBeans represented by an ObjectName pattern.
The listener to be removed must have been added by the subscribe method with the given name, filter,
and handback. If the name is a pattern, then the subscribe must have used the same
pattern. If the same listener has been subscribed more than once to the
name with the same filter and handback, only one listener is
removed.
name - The name of the MBean or an ObjectName pattern
representing a set of MBeans to which the listener was subscribed.listener - A listener that was previously subscribed to the
MBean(s).ListenerNotFoundException - The given listener was not
subscribed to the given name.subscribe(javax.management.ObjectName, javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
public void publish(ObjectName emitterName,
Notification n)
Sends a notification to the subscribers for a given MBean.
For each listener subscribed with an ObjectName that either
is equal to emitterName or is a pattern that matches emitterName, if the associated filter accepts the notification then it
is forwarded to the listener.
emitterName - The name of the MBean emitting the notification.n - The notification being sent by the MBean called
emitterName.IllegalArgumentException - If the emitterName of the
notification is null or is an ObjectName pattern.
public NotificationEmitter getNotificationEmitterFor(ObjectName name)
throws InstanceNotFoundException
Returns a NotificationEmitter object which can be used to
subscribe or unsubscribe for notifications with the named
mbean. The returned object implements addNotificationListener(listener, filter, handback) as
this.subscribe(name, listener, filter, handback)
and the two removeNotificationListener methods from NotificationEmitter as the corresponding unsubscribe methods
from this class.
name - The name of the MBean whose notifications are being
subscribed, or unsuscribed.NotificationEmitter
that can be used to subscribe or unsubscribe for
notifications emitted by the named MBean, or null if
the MBean does not emit notifications and should not
be considered as a NotificationBroadcaster. This class
never returns null but a subclass is allowed to.InstanceNotFoundException - if name does not exist.
This implementation never throws InstanceNotFoundException but
a subclass is allowed to override this method to do so.
|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.