/** * Removes all registrations for an mbean broadcaster. * * @param name the object name * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name) { if (name == null) throw new IllegalArgumentException("Null name"); ListenerRegistry registry = null; synchronized(registries) { registry = (ListenerRegistry) registries.remove(name); if (registry == null) return; } // Remove the registrations with the MBean for (ListenerRegistry.ListenerRegistrationIterator iterator = registry.iterator(); iterator.hasNext();) { ListenerRegistration registration = iterator.nextRegistration(); registration.removed(); } }
/** * Removes all registrations for an mbean broadcaster. * * @param name the object name * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name) { if (name == null) throw new IllegalArgumentException("Null name"); ListenerRegistry registry = null; synchronized(registries) { registry = (ListenerRegistry) registries.remove(name); if (registry == null) return; } // Remove the registrations with the MBean for (ListenerRegistry.ListenerRegistrationIterator iterator = registry.iterator(); iterator.hasNext();) { ListenerRegistration registration = iterator.nextRegistration(); registration.removed(); } }
public void sendNotification(Notification notification) { ListenerRegistry.ListenerRegistrationIterator iterator = registry.iterator(); while (iterator.hasNext()) { ListenerRegistration registration = iterator.nextRegistration(); NotificationFilter filter = registration.getFilter(); if (filter == null) handleNotification(registration.getListener(), notification, registration.getHandback()); else if (filter.isNotificationEnabled(notification)) handleNotification(registration.getListener(), notification, registration.getHandback()); } }
/** * Retrieve an iterator over the registrations<p> * * The iterator behaves like a snapshot of the registrations * is taken during this operation. * * @return the iterator */ public ListenerRegistrationIterator iterator() { return new ListenerRegistrationIterator(); }
/** * Convenience method to returned a typed object */ public ListenerRegistration nextRegistration() { return (ListenerRegistration) next(); }
public Object next() { if (hasNext() == false) throw new NoSuchElementException("Use hasNext before next"); return registrationIterator.next(); }