Please note that this documentation is not final and is subject to change.

Java™ Platform
Standard Ed. 7

DRAFT ea-b76

javax.management.event
Interface EventConsumer

All Known Implementing Classes:
EventClient, EventSubscriber, VirtualEventManager

public interface EventConsumer

This interface specifies methods to subscribe a listener to receive events from an MBean or a set of MBeans. The MBeans can already be registered in an MBean server, or they can be pending registration, or they can be MBeans that will never be registered, or they can be MBeans that will be registered then unregistered.

Since:
JMX 2.0

Method Summary
Modifier and Type Method and Description
 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.
 

Method Detail

subscribe

void subscribe(ObjectName name,
               NotificationListener listener,
               NotificationFilter filter,
               Object handback)
               throws IOException

Subscribes 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.

Parameters:
name - 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.
Throws:
IllegalArgumentException - If the name or listener is null.
IOException - for a remote client, thrown if an I/O error occurs.
See Also:
unsubscribe(ObjectName, NotificationListener)

unsubscribe

void unsubscribe(ObjectName name,
                 NotificationListener listener)
                 throws ListenerNotFoundException,
                        IOException

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. 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.

Parameters:
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).
Throws:
ListenerNotFoundException - The given listener was not subscribed to the given name.
IOException - for a remote client, thrown if an I/O error occurs.
See Also:
subscribe(javax.management.ObjectName, javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)

Java™ Platform
Standard Ed. 7

DRAFT ea-b76

Submit a bug or feature

Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.