<p>Adds a listener that will be notified on the given executor when
blocks are downloaded by the download peer.</p>
@see Peer#addBlocksDownloadedEventListener(Executor, BlocksDownloadedEventListener)
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);
    }
663981
@NonNull
    public ListenerToken addDocumentChangeListener(
        @NonNull String id,
        Executor executor,
        @NonNull DocumentChangeListener listener) {
        if (id == null) { throw new IllegalArgumentException("id cannot be null."); }
        if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }

        synchronized (lock) {
            mustBeOpen();
            return addDocumentChangeListener(executor, listener, id);
        }
    }
921656
public <R extends BProgramRunnerListener> R addListener(R aListener) {
        listeners.add(aListener);
        return aListener;
    }
731445
@Override
  public void addListener(INetworkConnectionListener listener) {
    if (!this.listeners.contains(listener)) {
      this.listeners.add(listener);
    }
  }
207062
public  void addEventSourceListener(EventSourceListener listener) {
        LOG.entering(CLASS_NAME, "addEventSourceListener", listener);
        _getDelegate().addEventSourceListener(listener);
    }
607681
public void addEventListener(EventType eventType, Consumer<PrimitiveEvent> listener) {
    executor.execute(() -> eventListeners.computeIfAbsent(eventType.canonicalize(), e -> Sets.newLinkedHashSet()).add(listener));
  }
1320738
@Override
    public synchronized void addChainEventListener(ChainEventListener cel, String chainName) throws InvalidChainNameException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addChainEventListener: chain=" + chainName + " listener=" + cel);
        }
        ChainDataImpl chainData = null;

        if (null == chainName) {
            InvalidChainNameException e = new InvalidChainNameException("Unable to register a listener for a chain with null name");
            //Race condition can occur where chain is stopped before we register the listener, no need to FFDC
            //FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
            throw e;
        }

        // Handle a listener registering for events from all chains.
        if (chainName.equals(ChainEventListener.ALL_CHAINS)) {
            for (ChainData chain : this.chainDataMap.values()) {
                ((ChainDataImpl) chain).addChainEventListener(cel);
            }
            this.globalChainEventListeners.add(cel);
        } else {
            // Extract the chain config from the framework.
            chainData = this.chainDataMap.get(chainName);
            // Verify the chain config is in the framework
            if (null == chainData) {
                InvalidChainNameException e = new InvalidChainNameException("Unable to register listener for unknown chain config, " + chainName);
                //Race condition can occur where chain is stopped before we register the listener, no need to FFDC
                //FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
                throw e;
            }
            chainData.addChainEventListener(cel);
        }
    }
231197
private ListenerToken addDatabaseChangeListener(Executor executor, DatabaseChangeListener listener) {
        // NOTE: caller method is synchronized.
        if (dbChangeNotifier == null) {
            dbChangeNotifier = new ChangeNotifier<>();
            registerC4DBObserver();
        }
        return dbChangeNotifier.addChangeListener(executor, listener);
    }
103272
public void addConnectionEventListener(
            final ConnectionEventListener listener) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "addConnectionEventListener", listener);
        }

        _eventListeners.add(listener);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "addConnectionEventListener");
        }

    }
61224
public void addListener(RunListener listener) {
        if (listener == null) {
            throw new NullPointerException("Cannot add a null listener");
        }
        listeners.add(wrapIfNotThreadSafe(listener));
    }
871055
public synchronized void addEventListener(EventListener listener)
        throws IllegalArgumentException
    {
        if ((listener instanceof HttpSessionActivationListener)
            || (listener instanceof HttpSessionAttributeListener)
            || (listener instanceof HttpSessionBindingListener)
            || (listener instanceof HttpSessionListener))
        {
            if (_sessionManager != null)
                _sessionManager.addEventListener(listener);
            _sessionListeners= LazyList.add(_sessionListeners, listener);
        }

        if (listener instanceof ServletRequestListener)
        {
            _requestListeners= LazyList.add(_requestListeners, listener);
        }

        if (listener instanceof ServletRequestAttributeListener)
        {
             _requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener);
        }

        if (listener instanceof ServletContextAttributeListener)
        {            
            _contextAttributeListeners= LazyList.add(_contextAttributeListeners, listener);
        }
        
        super.addEventListener(listener);
    }
477379
@Override
    public void addEventListener(EventListener listener) {
        if (listener instanceof SessionListener) {
            sessionListeners.add((SessionListener)listener);
        }
        if (listener instanceof SessionAttributeListener) {
            sessionAttributeListeners.add((SessionAttributeListener)listener);
        }
    }
1125248
public String registerBlockListener(BlockListener listener) throws InvalidArgumentException {

        if (shutdown) {
            throw new InvalidArgumentException(format("Channel %s has been shutdown.", name));
        }

        if (null == listener) {
            throw new InvalidArgumentException("Listener parameter is null.");
        }

        String handle = new BL(listener).getHandle();

        logger.trace(format("Register event BlockEvent listener %s", handle));

        return handle;

    }
838023
public void addReaderListener(ReaderListener readerListener) {
        if (readerListener == null) {
            return;
        }
        synchronized (listeners) {
            if (!listeners.contains(readerListener)) {
                listeners.add(readerListener);
            }
        }
    }
187649
public void addListener(BaseListener listener)
    {
        listener.setNextListener(null);  // Just being safe
        if (this.getTable() != null)
            this.getTable().addListener(this, (FileListener)listener);   // Give the table a chance to clone this or whatever.
        else
            this.doAddListener((FileListener)listener);
    }
1191737
public void addListener(final PathAlterationListener listener) {
    if (listener != null) {
      this.listeners.put(listener, new ExceptionCatchingPathAlterationListenerDecorator(listener));
    }
  }
224290
private void add(Peer peer) {
		String id = peer.getId();
		peers.put(id, peer);
		timeouts.put(id, executor.schedule(new Deactivate(id), delay, MILLISECONDS));
		notifyConnected(new Builder(peer).status(Status.CONNECTED).build());
		notifyActive(peer);
	}