/** * Removes all registrations for a listener. * * @param listener the listener to remove * @exception ListenerNotFoundException when the listener is not registered */ public void remove(NotificationListener listener) throws ListenerNotFoundException { ArrayList registrations = null; synchronized(listeners) { if (listeners.containsKey(listener) == false) throw new ListenerNotFoundException("Listener not found " + listener); HashMap newListeners = (HashMap) listeners.clone(); registrations = (ArrayList) newListeners.remove(listener); listeners = newListeners; } for (Iterator iterator = registrations.iterator(); iterator.hasNext();) { ListenerRegistration registration = (ListenerRegistration) iterator.next(); registration.removed(); } }
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(); } }
/** * 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(); } }