Sets an interface for when an ANR is detected.
If not set, the default behavior is to throw an error and crash the application.

@param listener The new listener or null
@return itself for chaining.
971910
public ANRWatchDog setANRListener(ANRListener listener) {
        if (listener == null) {
            _anrListener = DEFAULT_ANR_LISTENER;
        } else {
            _anrListener = listener;
        }
        return this;
    }
322290
public MarcContentHandler setMarcListener(String type, MarcListener listener) {
        this.listeners.put(type, listener);
        return this;
    }
915265
public void registerListener(final StatusListener listener) {
        listenersLock.writeLock().lock();
        try {
            listeners.add(listener);
            final Level lvl = listener.getStatusLevel();
            if (listenersLevel < lvl.intLevel()) {
                listenersLevel = lvl.intLevel();
            }
        } finally {
            listenersLock.writeLock().unlock();
        }
    }
110025
public S onSuccess(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener) {
    successListener = EventListener.of(Assert.notNull(listener, "listener"));
    return (S) this;
  }
1217577
public static @Nullable View.OnClickListener guarded(@Nullable final View.OnClickListener listener) {
		if (listener != null) {
			return new View.OnClickListener() {
				@Override
				public void onClick(View v) {
					try {
						listener.onClick(v);
					} catch (Exception e) {
						ApptentiveLog.e(e, "Exception while handling click listener");
						logException(e);
					}
				}
			};
		}

		return null;
	}
626094
public void addListener(BaseListener listener)
    {
        listener.setNextListener(null);  // Just being safe
        if ((this.getRecord() != null) && (this.getRecord().getTable() != null))
            this.getRecord().getTable().addListener((FieldListener)listener, this);   // Give the table a chance to clone this or whatever.
        else
            this.doAddListener((FieldListener)listener);
    }
801195
public Searcher registerErrorListener(@NonNull AlgoliaErrorListener errorListener) {
        if (!errorListeners.contains(errorListener)) {
            errorListeners.add(errorListener);
        }
        return this;
    }
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
    }
1346724
public void addLoginListener(LoginListener listener){
        logger.debug("addLoginListener");
        Subscription subscription = loginEventPublisher
                .subscribeOn(config.subscribeOn())
                .observeOn(config.observeOn())
                .subscribe(listener);
        listener.setSubscription(subscription);
    }
369536
public BaseListener setNextListener(BaseListener listener)
    {
        BaseListener listenerTemp = m_nextListener;
        m_nextListener = listener;
        return listenerTemp;
    }
1186505
public void addObservableListener(ObservableListener<T> listener)
	{
		checkNotNull(listener, "listener cannot be null");

		listeners.add(ObservableListener.class, listener);
	}
1071110
public Closeable onUnsubscribeChannelEvent(final Consumer<BitfinexStreamSymbol> listener) {
        unsubscribeChannelConsumers.offer(listener);
        return () -> unsubscribeChannelConsumers.remove(listener);
    }
538798
public void addFirstListener(RunListener listener) {
        if (listener == null) {
            throw new NullPointerException("Cannot add a null listener");
        }
        listeners.add(0, wrapIfNotThreadSafe(listener));
    }
1036354
public <T extends EventListener> void subscribe(EventPublisher source, T listener) {
	if (source == null || listener == null) {
	    throw new IllegalArgumentException("Parameters cannot be null");
	}
	log.debug("[subscribe] Adding {} --> {}", source.getClass().getName(), listener.getClass().getName());

	GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source);
	if (dispatcher == null) {
	    log.warn("[subscribe] Registering with a disconnected source");
	    dispatcher = createDispatcher(source);
	}

	dispatcher.addListener(listener);

    }
960440
public Listener<T> add(Consumer<T> listener) {
    Assert.notNull(listener, "listener");
    ListenerHolder holder = new ListenerHolder(listener, ThreadContext.currentContext());
    listeners.add(holder);
    return holder;
  }
1233176
public ListenerRegistration<RuleLifecycleListener> addLifecycleListener(final RuleLifecycleListener listener)
    {
        this.listeners.add(listener);
        return new ListenerRegistration<RuleLifecycleListener>()
        {
            @Override
            public RuleLifecycleListener removeListener()
            {
                listeners.remove(listener);
                return listener;
            }
        };

    }
454817
public void setListener(T listener) {
		Assert.notNull(listener, "Listener must not be null");
		Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type");
		this.listener = listener;
	}