Add this executor as listener for MBeanServer notification so that we can update
the local timestamp for when the set of registered MBeans has changed last.
772064
protected void registerForMBeanNotifications() {
        Set<MBeanServerConnection> servers = getMBeanServers();
        Exception lastExp = null;
        StringBuilder errors = new StringBuilder();
        for (MBeanServerConnection server : servers) {
            try {
                JmxUtil.addMBeanRegistrationListener(server,this,null);
            } catch (IllegalStateException e) {
                lastExp = updateErrorMsg(errors,e);
            }
        }
        if (lastExp != null) {
            throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp);
        }
    }
651098
def _process_change(self, server_description):
        
        td_old = self._description
        if self._publish_server:
            old_server_description = td_old._server_descriptions[
                server_description.address]
            self._events.put((
                self._listeners.publish_server_description_changed,
                (old_server_description, server_description,
                 server_description.address, self._topology_id)))

        self._description = updated_topology_description(
            self._description, server_description)

        self._update_servers()
        self._receive_cluster_time_no_lock(server_description.cluster_time)

        if self._publish_tp:
            self._events.put((
                self._listeners.publish_topology_description_changed,
                (td_old, self._description, self._topology_id)))

        # Wake waiters in select_servers().
        self._condition.notify_all()
685068
public boolean addFailOverListener(FailOverListener localListener) {
		if (logger.isDebugEnabled()) {
			logger.debug("Adding local listener " + localListener);
		}
		for(FailOverListener failOverListener : failOverListeners) {
			if (failOverListener.getBaseFqn().getFqn().equals(localListener.getBaseFqn().getFqn())) {
				return false; 
			}
		}
		return failOverListeners.add(localListener);		
	}
930631
public void addListener(final CancellationListener cancellationListener,
                          final Executor executor) {
    checkNotNull(cancellationListener, "cancellationListener");
    checkNotNull(executor, "executor");
    if (canBeCancelled()) {
      ExecutableListener executableListener =
          new ExecutableListener(executor, cancellationListener);
      synchronized (this) {
        if (isCancelled()) {
          executableListener.deliver();
        } else {
          if (listeners == null) {
            // Now that we have a listener we need to listen to our parent so
            // we can cascade listener notification.
            listeners = new ArrayList<>();
            listeners.add(executableListener);
            if (cancellableAncestor != null) {
              cancellableAncestor.addListener(parentListener, DirectExecutor.INSTANCE);
            }
          } else {
            listeners.add(executableListener);
          }
        }
      }
    }
  }
248052
protected void notifyListener(final ExecutorService executor,
    final Future<?> future, final GenericCompletionListener listener) {
    executor.submit(new Runnable() {
      @Override
      public void run() {
        try {
          listener.onComplete(future);
        } catch(Throwable t) {
          getLogger().warn(
            "Exception thrown wile executing " + listener.getClass().getName()
              + ".operationComplete()", t);
        }
      }
    });
  }
569491
private void updateValue() {
        if (table != null) {
            int oldCount = this.count;
            this.count = table.getRowCount();
            maybeNotifyListeners(oldCount, count);
        }
    }
329031
void notifyListener() {
        Node<K, V> node;
        while ((node = pendingNotifications.poll()) != null) {
            listener.onEviction(node.key, node.getValue());
        }
    }
1350477
protected final void notifyListeners() {
        Iterator<SMTPClientFutureListener<E>> it = null;
        synchronized (this) {
            if (listeners != null) {
                // notify the listeners
                it  = listeners.iterator();

                listeners = null;
            }
        }
        if (it != null) {
            while(it.hasNext()) {
                SMTPClientFutureListener<E> listener = null;
                try {
                    listener = it.next();
                    listener.operationComplete(this);
                } catch (Throwable e) {
                    LOGGER.warn("Exception thrown while executing " + SMTPClientFutureListener.class.getName() + " " + listener, e);
                }
            }
        }
    }
1048102
public void addListeners()
    {
        super.addListeners();
        
        this.addListener(new DateChangedHandler((DateTimeField)this.getField(Person.DATE_CHANGED)));
        this.addListener(new SetUserIDHandler(Person.CHANGED_ID, false));
        
        this.getField(Person.NAME).addListener(new CopyLastHandler(this.getField(Person.NAME_SORT)));    // Only if dest is null (ie., company name is null)
        this.getField(Person.NAME_SORT).addListener(new FieldToUpperHandler(null));
        
        this.getField(Person.POSTAL_CODE).addListener(new CopyFieldHandler(this.getField(Person.POSTAL_CODE_SORT)));
    }
1082998
public void addGetDataEventListener(final Executor executor, final GetDataEventListener listener) {
        peerGetDataEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor));
        for (Peer peer : getConnectedPeers())
            peer.addGetDataEventListener(executor, listener);
        for (Peer peer : getPendingPeers())
            peer.addGetDataEventListener(executor, listener);
    }
832980
private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {
        for (final MasterListener listener : getMasterListeners()) {
            try {
                listener.masterChanged(update);
            } catch (Throwable t) {
                logger.warn("Problem delivering master changed announcement to listener", t);
            }
        }
    }
969287
public void addBlocksDownloadedEventListener(Executor executor, BlocksDownloadedEventListener listener) {
        peersBlocksDownloadedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor));
        for (Peer peer : getConnectedPeers())
            peer.addBlocksDownloadedEventListener(executor, listener);
        for (Peer peer : getPendingPeers())
            peer.addBlocksDownloadedEventListener(executor, listener);
    }
285875
@Override
    public void registerConnectionChangeListener(ConnectionChangeListener listener) {
        connectionListeners.add(listener);
        executor.execute(() -> listener.connectionChange(this, isConnected()));
    }
1171563
public void addDiscoveredEventListener(Executor executor, PeerDiscoveredEventListener listener) {
        peerDiscoveredEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor));
    }
1051784
public void addServerNotificationListener(RESTRequest request, ServerNotificationRegistration serverNotificationRegistration, JSONConverter converter) {
        NotificationTargetInformation nti = toNotificationTargetInformation(request, serverNotificationRegistration.objectName.getCanonicalName());

        //Fetch the filter/handback objects
        NotificationFilter filter = (NotificationFilter) getObject(serverNotificationRegistration.filterID, serverNotificationRegistration.filter, converter);
        Object handback = getObject(serverNotificationRegistration.handbackID, serverNotificationRegistration.handback, converter);

        // Check whether the producer of the notification is local or remote.
        if (nti.getRoutingInformation() == null) {
            //Add to the MBeanServer
            MBeanServerHelper.addServerNotification(serverNotificationRegistration.objectName,
                                                    serverNotificationRegistration.listener,
                                                    filter,
                                                    handback,
                                                    converter);
        } else {
            // Add the notification listener to the Target-Client Manager through EventAdmin
            MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
            helper.addRoutedServerNotificationListener(nti,
                                                       serverNotificationRegistration.listener,
                                                       filter,
                                                       handback,
                                                       converter);
        }

        //Make the local ServerNotification
        ServerNotification serverNotification = new ServerNotification();
        serverNotification.listener = serverNotificationRegistration.listener;
        serverNotification.filter = serverNotificationRegistration.filterID;
        serverNotification.handback = serverNotificationRegistration.handbackID;

        //See if there's a list already
        List<ServerNotification> list = serverNotifications.get(nti);

        if (list == null) {
            list = Collections.synchronizedList(new ArrayList<ServerNotification>());
            List<ServerNotification> mapList = serverNotifications.putIfAbsent(nti, list);

            if (mapList != null) {
                list = mapList;
            }
        }

        //Add the new notification into the list
        list.add(serverNotification);
    }
651269
private void deliverTempoChangedAnnouncement(final double tempo) {
        for (final MasterListener listener : getMasterListeners()) {
            try {
                listener.tempoChanged(tempo);
            } catch (Throwable t) {
                logger.warn("Problem delivering tempo changed announcement to listener", t);
            }
        }
    }
300693
public void addMasterListeners()
    {
        super.addMasterListeners();
        this.addListener(new SetUserIDHandler(Issue.ENTERED_BY_USER_ID, true));
        this.addListener(new SetUserIDHandler(Issue.CHANGED_BY_USER_ID, true));
        this.addListener(new DateChangedHandler(Issue.CHANGED_DATE));
    }