站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

ListenerRegistry (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.notification
Class ListenerRegistry

java.lang.Object
  extended byorg.jboss.mx.notification.ListenerRegistry

public class ListenerRegistry
extends Object

A notification listener registry.

For addition and removal, the registrations are deeply cloned to allow the registrations to be iterated externally without incurring the cost of synchronization.

Version:
$Revision: 1.4 $

Revisions:

20030806 Juha Lindfors:

  • Added removeAll()
Author:
Adrian Brock., Juha Lindfors.
See Also:
ListenerRegistration

Nested Class Summary
 class ListenerRegistry.ListenerRegistrationIterator
           
 
Constructor Summary
ListenerRegistry()
          Create a notification listener registry using the default listener registration factory.
ListenerRegistry(ListenerRegistrationFactory factory)
          Create a notification listener registry using the passed listener registration factory.
 
Method Summary
 void add(NotificationListener listener, NotificationFilter filter, Object handback)
          Adds a listener to a broadcaster
 boolean isEmpty()
          Test whether the registry is empty
 ListenerRegistry.ListenerRegistrationIterator iterator()
          Retrieve an iterator over the registrations
 void remove(NotificationListener listener)
          Removes all registrations for a listener.
 void remove(NotificationListener listener, NotificationFilter filter, Object handback)
          Removes only the registrations for a listener that match the filter and handback.
 void removeAll()
          Removes all listeners from this listener registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerRegistry

public ListenerRegistry()
Create a notification listener registry using the default listener registration factory.


ListenerRegistry

public ListenerRegistry(ListenerRegistrationFactory factory)
Create a notification listener registry using the passed listener registration factory.

Parameters:
factory - the factory to create registrations, use null for the default factory
Method Detail

add

public void add(NotificationListener listener,
                NotificationFilter filter,
                Object handback)
         throws JMException
Adds a listener to a broadcaster

Parameters:
listener - the listener to register
filter - filters the notifications in the broadcaster, can be null
handback - the object to include in the notification, can be null
Throws:
IllegalArgumentException - for a null listener
JMException - for an error adding to the registry

remove

public void remove(NotificationListener listener)
            throws ListenerNotFoundException
Removes all registrations for a listener.

Parameters:
listener - the listener to remove
Throws:
ListenerNotFoundException - when the listener is not registered

remove

public void remove(NotificationListener listener,
                   NotificationFilter filter,
                   Object handback)
            throws ListenerNotFoundException
Removes only the registrations for a listener that match the filter and handback.

Parameters:
listener - the listener to remove
filter - the filter of the registration to remove
handback - the handback object of the registration to remove
Throws:
ListenerNotFoundException - when the listener is not registered

removeAll

public void removeAll()
Removes all listeners from this listener registry.


iterator

public ListenerRegistry.ListenerRegistrationIterator iterator()
Retrieve an iterator over the registrations

The iterator behaves like a snapshot of the registrations is taken during this operation.

Returns:
the iterator

isEmpty

public boolean isEmpty()
Test whether the registry is empty

Returns:
true when it is empty, false otherwise


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.