public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { try { registry.add(listener, filter, handback); } catch (JMException e) { // This shouldn't happen? throw new RuntimeException(e.toString()); } }
/** * Removes only the registrations for a listener that match the filter and handback. * * @param name the object name * @param listener the listener to remove * @param filter the filter of the registration to remove * @param handback the handback object of the registration to remove * @exception ListenerNotFoundException when the listener is not registered * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { if (name == null) throw new IllegalArgumentException("Null name"); synchronized(registries) { ListenerRegistry registry = (ListenerRegistry) registries.get(name); if (registry == null) throw new ListenerNotFoundException("Listener not found listener=" + listener + " filter=" + filter + " handback=" + handback + " for object name " + name); registry.remove(listener, filter, handback); if (registry.isEmpty()) registries.remove(name); } }
/** * Clears all listener registries from this registry. */ public void removeAll() { synchronized (registries) { Iterator it = registries.keySet().iterator(); while (it.hasNext()) { ListenerRegistry registry = (ListenerRegistry)registries.get(it.next()); registry.removeAll(); } } }
registry = new ListenerRegistry(new MBeanServerListenerRegistrationFactory(name, broadcaster)); registries.put(name, registry); registry.add(listener, filter, handback);
/** * 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 removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { registry.remove(listener, filter, handback); }
registry = new ListenerRegistry(new MBeanServerListenerRegistrationFactory(name, broadcaster)); registries.put(name, registry); registry.add(listener, filter, handback);
/** * 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 a listener. * * @param name the object name * @param listener the listener to remove * @exception ListenerNotFoundException when the listener is not registered * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name, NotificationListener listener) throws ListenerNotFoundException { if (name == null) throw new IllegalArgumentException("Null name"); synchronized(registries) { ListenerRegistry registry = (ListenerRegistry) registries.get(name); if (registry == null) throw new ListenerNotFoundException("Listener not found " + listener + " for object name " + name); registry.remove(listener); if (registry.isEmpty()) registries.remove(name); } }
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()); } }
/** * Clears all listener registries from this registry. */ public void removeAll() { synchronized (registries) { Iterator it = registries.keySet().iterator(); while (it.hasNext()) { ListenerRegistry registry = (ListenerRegistry)registries.get(it.next()); registry.removeAll(); } } }
/** * Removes all registrations for a listener. * * @param name the object name * @param listener the listener to remove * @exception ListenerNotFoundException when the listener is not registered * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name, NotificationListener listener) throws ListenerNotFoundException { if (name == null) throw new IllegalArgumentException("Null name"); synchronized(registries) { ListenerRegistry registry = (ListenerRegistry) registries.get(name); if (registry == null) throw new ListenerNotFoundException("Listener not found " + listener + " for object name " + name); registry.remove(listener); if (registry.isEmpty()) registries.remove(name); } }
/** * Removes only the registrations for a listener that match the filter and handback. * * @param name the object name * @param listener the listener to remove * @param filter the filter of the registration to remove * @param handback the handback object of the registration to remove * @exception ListenerNotFoundException when the listener is not registered * @exception IllegalArgumentException for a null object name */ public void remove(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException { if (name == null) throw new IllegalArgumentException("Null name"); synchronized(registries) { ListenerRegistry registry = (ListenerRegistry) registries.get(name); if (registry == null) throw new ListenerNotFoundException("Listener not found listener=" + listener + " filter=" + filter + " handback=" + handback + " for object name " + name); registry.remove(listener, filter, handback); if (registry.isEmpty()) registries.remove(name); } }