Adds a new application even listener to be notified when an application
has fully started or will begin stopping.

@param listener the listener
497501
public void addApplicationEventListener(EJBApplicationEventListener listener) // F743-26072
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "addApplicationEventListener: " + listener);

        if (ivApplicationEventListeners == null)
        {
            ivApplicationEventListeners = new ArrayList<EJBApplicationEventListener>();
        }
        ivApplicationEventListeners.add(listener);
    }
1020247
public void addListener(GramJobListener listener) {
	if (listeners == null) listeners = new Vector();
	listeners.addElement(listener);
    }
1186505
public void addObservableListener(ObservableListener<T> listener)
	{
		checkNotNull(listener, "listener cannot be null");

		listeners.add(ObservableListener.class, listener);
	}
1299254
@Override
    @Synchronized
    public void addListener(ClusterListener listener) {
        Preconditions.checkNotNull(listener, "listener");
        if (!cache.isPresent()) {
            initializeCache();
        }
        cache.get().getListenable().addListener(pathChildrenCacheListener(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
    }
914054
@Override
  public void addListener(final AgentModel.Listener listener) {
    listeners.add(listener);
    listener.tasksChanged(this);
  }
1096768
public void addListener(EnvLoaderListener listener)
  {
    super.addListener(listener);
    synchronized (_listeners) {
      for (int i = _listeners.size() - 1; i >= 0; i--) {
        EnvLoaderListener oldListener = _listeners.get(i);

        if (listener == oldListener) {
          return;
        }
        else if (oldListener == null)
          _listeners.remove(i);
      }

      _listeners.add(listener);
    }

    if (getLifecycle().isStarting()) {
      listener.environmentBind(this);
    }

    if (getLifecycle().isStarting() && _isConfigComplete) {
      listener.environmentStart(this);
    }
  }
1008389
public void addLifecycleListener(java.util.EventListener listener) {
        String listenerClassName = getClassName(listener);
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
                logger.entering(CLASS_NAME, "addLifecycleListener : listenerClass = " + listenerClassName);     
        }       

        if (listener != null) {
            if (listener instanceof javax.servlet.ServletContextListener) {
                addServletContextListener(listener);
            }
            if (listener instanceof javax.servlet.ServletContextAttributeListener) {
                // add to the context attr listener list
                servletContextLAttrListeners.add(listener);
            }

            if (listener instanceof javax.servlet.http.HttpSessionListener) {
                // add to the session listener list
                this.sessionCtx.addHttpSessionListener((javax.servlet.http.HttpSessionListener) listener, name);

                // 434577
                // add to a mirror list because we can't get access to the list
                // the
                // session context is holding on to later on.

                this.sessionListeners.add(listener);
                this.addedSessionListeners.add(listener);
            }
            
            // Servlet 3.1
            checkForSessionIdListenerAndAdd(listener);

            // \PK34418 begins
            if (listener instanceof javax.servlet.http.HttpSessionAttributeListener) {
                // add to the session attribute listener list
                if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
                    logger
                            .logp(Level.FINE, CLASS_NAME, "addLifecycleListener",
                                    "listener instanceof javax.servlet.http.HttpSessionAttributeListener");
                    logger.logp(Level.FINE, CLASS_NAME, "addLifecycleListener", "name : " + name);
                }
                this.sessionCtx.addHttpSessionAttributeListener((HttpSessionAttributeListener) listener, name);

                // 434577
                // add to a mirror list because we can't get access to the list
                // the
                // session context is holding on to later on.

                this.sessionAttrListeners.add(listener);
                this.addedSessionAttrListeners.add(listener);

            }// PK34418

            // 2.4 Listeners
            if (listener instanceof javax.servlet.ServletRequestListener) {
                servletRequestListeners.add(listener);
            }
            if (listener instanceof javax.servlet.ServletRequestAttributeListener) {
                servletRequestLAttrListeners.add(listener);
            }

            if (listener instanceof javax.servlet.http.HttpSessionActivationListener) {
                sessionActivationListeners.add(listener);
            }

            if (listener instanceof javax.servlet.http.HttpSessionBindingListener) {
                sessionBindingListeners.add(listener);
            }
        }
        logger.exiting(CLASS_NAME, "addLifecycleListener");
    }
776874
public void addSpiderListener(SpiderListener listener) {
		if (spider != null) {
			this.spider.addSpiderListener(listener);
		} else {
			this.pendingSpiderListeners.add(listener);
		}
	}
1191737
public void addListener(final PathAlterationListener listener) {
    if (listener != null) {
      this.listeners.put(listener, new ExceptionCatchingPathAlterationListenerDecorator(listener));
    }
  }
565549
public void startSetup(@NotNull final OnIabSetupFinishedListener listener) {
        if (options != null) {
            Logger.d("startSetup() options = ", options);
        }
        //noinspection ConstantConditions
        if (listener == null) {
            throw new IllegalArgumentException("Setup listener must be not null!");
        }
        if (setupState != SETUP_RESULT_NOT_STARTED && setupState != SETUP_RESULT_FAILED) {
            throw new IllegalStateException("Couldn't be set up. Current state: " + setupStateToString(setupState));
        }
        setupState = SETUP_IN_PROGRESS;
        setupExecutorService = Executors.newSingleThreadExecutor();

        // Compose full list of available stores to check billing for
        availableAppstores.clear();
        // Add all manually supplied Appstores
        availableAppstores.addAll(options.getAvailableStores());
        final List<String> storeNames = new ArrayList<String>(options.getAvailableStoreNames());
        // Remove already added stores
        for (final Appstore appstore : availableAppstores) {
            storeNames.remove(appstore.getAppstoreName());
        }
        // Instantiate and add all known wrappers
        final List<Appstore> instantiatedAppstores = new ArrayList<Appstore>();
        for (final String storeName : options.getAvailableStoreNames()) {
            if (appStoreFactoryMap.containsKey(storeName)) {
                final Appstore appstore = appStoreFactoryMap.get(storeName).get();
                instantiatedAppstores.add(appstore);
                availableAppstores.add(appstore);
                storeNames.remove(storeName);
            }
        }
        // Look among open stores for specified store names
        if (!storeNames.isEmpty()) {
            discoverOpenStores(new OpenStoresDiscoveredListener() {
                @Override
                public void openStoresDiscovered(@NotNull final List<Appstore> appStores) {
                    // Add all specified open stores
                    for (final Appstore appstore : appStores) {
                        final String name = appstore.getAppstoreName();
                        if (storeNames.contains(name)) {
                            availableAppstores.add(appstore);
                        } else {
                            final AppstoreInAppBillingService billingService;
                            if ((billingService = appstore.getInAppBillingService()) != null) {
                                billingService.dispose();
                                Logger.d("startSetup() billing service disposed for ", appstore.getAppstoreName());
                            }
                        }
                    }
                    final Runnable cleanup = new Runnable() {
                        @Override
                        public void run() {
                            for (final Appstore appstore : instantiatedAppstores) {
                                final AppstoreInAppBillingService billingService;
                                if ((billingService = appstore.getInAppBillingService()) != null) {
                                    billingService.dispose();
                                    Logger.d("startSetup() billing service disposed for ", appstore.getAppstoreName());
                                }
                            }
                        }
                    };
                    if (setupState != SETUP_IN_PROGRESS) {
                        cleanup.run();
                        return;
                    }
                    setupWithStrategy(new OnIabSetupFinishedListener() {
                        @Override
                        public void onIabSetupFinished(final IabResult result) {
                            listener.onIabSetupFinished(result);
                            instantiatedAppstores.remove(OpenIabHelper.this.appstore);
                            cleanup.run();
                        }
                    });
                }
            });
        } else {
            setupWithStrategy(listener);
        }
    }
477379
@Override
    public void addEventListener(EventListener listener) {
        if (listener instanceof SessionListener) {
            sessionListeners.add((SessionListener)listener);
        }
        if (listener instanceof SessionAttributeListener) {
            sessionAttributeListeners.add((SessionAttributeListener)listener);
        }
    }
1335707
public void addSelectionChangedListener(ISelectionChangedListener listener)
	{
		if (fOutlineViewer != null)
		{
			fOutlineViewer.addSelectionChangedListener(listener);
		} else
		{
			fSelectionChangedListeners.add(listener);
		}
	}
601356
@Override
    public void addConnectionEventListener( ConnectionEventListener listener ) {
        if (listener == null) {
            throw new IllegalArgumentException("Listener is null");
        }
        listeners.add(listener);
    }
969438
public synchronized void addListener(AuthListener listener) {
        if (getListeners().contains(listener)){
            return;
        }
        mListeners.add(new WeakReference<>(listener));
    }
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);
    }
29945
public void addListener(UpdateCheckListener newListener) {
        if (newListener == null) {
            throw new IllegalArgumentException("newListener");
        }
        GatewayVersion latestGatewayVersion = getLatestGatewayVersion();
        if (latestGatewayVersion != null && latestGatewayVersion.compareTo(currentVersion) > 0) {
            newListener.newVersionAvailable(currentVersion, latestGatewayVersion);
        }
        listeners.add(newListener);
    }