Set the given DocumentReplicationListener to the this replicator.

@param listener
@return ListenerToken A token to remove the handler later
960708
@NonNull
    public ListenerToken addDocumentReplicationListener(@NonNull DocumentReplicationListener listener) {
        if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }

        return addDocumentReplicationListener(null, listener);
    }
1017200
protected Future<T> removeFromListeners(
    GenericCompletionListener<? extends Future<T>> listener) {
    if (listener == null) {
      throw new IllegalArgumentException("The listener can't be null.");
    }

    if (!isDone()) {
      synchronized(this) {
        listeners.remove(listener);
      }
    }
    return this;
  }
110025
public S onSuccess(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener) {
    successListener = EventListener.of(Assert.notNull(listener, "listener"));
    return (S) this;
  }
388167
public ANRWatchDog setInterruptionListener(InterruptionListener listener) {
        if (listener == null) {
            _interruptionListener = DEFAULT_INTERRUPTION_LISTENER;
        } else {
            _interruptionListener = listener;
        }
        return this;
    }
1122316
public void removeReferenceListener(ReferenceListener listener) {
		final List<ReferenceListener> list = this.listeners;
		if (list != null) {
			synchronized (list) {
				list.remove(listener);
				if (list.isEmpty()) {
					this.listeners = null;
				}
			}
		}
	}
562662
void addChronoChangedListener(Consumer<Chronology> listener) {
        if (chronoListeners == null) {
            chronoListeners = new ArrayList<Consumer<Chronology>>();
        }
        chronoListeners.add(listener);
    }
236640
public String replace(String input, final UriPlaceHolderReplacerListener listener) {
		final List<Triple<Token, Token, String>> replace = new ArrayList<>();

		UriBaseListener rewriterListener = new UriBaseListener() {

			@Override
			public void enterBind_parameter(Bind_parameterContext ctx) {
				String value = listener.onParameterName(pathSegmentIndex, ctx.bind_parameter_name().getText());
				replace.add(new Triple<Token, Token, String>(ctx.start, ctx.stop, value));
			}

			@Override
			public void enterPath_segment(Path_segmentContext ctx) {
				pathSegmentIndex++;
			}
		};

		return replaceInternalFromUri(input, replace, rewriterListener);
	}
767581
@NonNull
    public ListenerToken addChangeListener(Executor executor, @NonNull ReplicatorChangeListener listener) {
        if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }

        synchronized (lock) {
            if (listener == null) { throw new IllegalArgumentException(); }
            final ReplicatorChangeListenerToken token = new ReplicatorChangeListenerToken(executor, listener);
            changeListenerTokens.add(token);
            return token;
        }
    }
1343567
public void addItemDeleteListener(ItemDeleteListener listener) {
        StanzaListener delListener = new ItemDeleteTranslator(listener);
        itemDeleteToListenerMap.put(listener, delListener);
        EventContentFilter deleteItem = new EventContentFilter(EventElementType.items.toString(), "retract");
        EventContentFilter purge = new EventContentFilter(EventElementType.purge.toString());

        // TODO: Use AsyncButOrdered (with Node as Key?)
        pubSubManager.getConnection().addSyncStanzaListener(delListener, new OrFilter(deleteItem, purge));
    }
387233
public <T> void registerRefListener(T oldObject, final Listener<T> listener) {
    checkNotNull(oldObject);
    checkNotNull(listener);
    Object oldMapping = mappings.get(oldObject);
    if (oldMapping == null) {
      // store the listener so it will be run when the old object mapping is registered
      mappings.put(oldObject, listener);
    } else if (oldMapping instanceof Listener) {
      // chain the listeners
      @SuppressWarnings("unchecked") // Listener<T> can only be registered with a T
      final Listener<T> oldListener = (Listener) oldMapping;
      mappings.put(oldObject, chainListeners(listener, oldListener));
    } else {
      // if there was a value mapped to the old object it must have been a T
      @SuppressWarnings("unchecked")
      T typedValue = (T) oldMapping;
      listener.newVersion(typedValue);
    }
  }
797741
public void removeEventSourceListener(EventSourceListener listener) {
        LOG.entering(CLASS_NAME, "removeEventSourceListener", listener);
        _getDelegate().removeEventSourceListener(listener);
    }
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);
    }
339858
public void doAddListener(BaseListener listener)
    {
        if (m_listener != null)
            m_listener.doAddListener((FileListener)listener);
        else
            m_listener = (FileListener)listener;
        boolean bOldState = listener.setEnabledListener(false);   // To disable recursive forever loop!
        listener.setOwner(this);
        listener.setEnabledListener(bOldState);        // Renable the listener to eliminate echos
    }
130724
public void doAddListener(BaseListener listener)
    {
        if (m_nextListener != null)
            m_nextListener.doAddListener(listener);
        else
            m_nextListener = listener;
    }
96746
@NonNull
    public ListenerToken addChangeListener(Executor executor, @NonNull DatabaseChangeListener listener) {
        if (listener == null) { throw new IllegalArgumentException("listener cannot be null."); }

        synchronized (lock) {
            mustBeOpen();
            return addDatabaseChangeListener(executor, listener);
        }
    }
861673
public void addReferenceListener(ReferenceListener listener) {
		if (this.listeners == null) {
			this.listeners = new LinkedList<>();
		}
		final List<ReferenceListener> list = this.listeners;
		synchronized (list) {
			list.add(listener);
		}
	}
818448
@NonNull
    public ListenerToken addDocumentChangeListener(
        @NonNull String id,
        @NonNull DocumentChangeListener listener) {
        return addDocumentChangeListener(id, null, listener);
    }