Internal method to add a listener to the end of the chain.
Sets the listener's owner to this.
@param theBehavior Listener or Filter to add to this record.
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
    }
665453
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
            if (m_converter != null) if (m_converter.getField() != null)
                if (((BaseField)m_converter.getField()).getRecord() != owner)
                    {   // Points to different file... make sure this is removed if the other file is closed
                        ((BaseField)m_converter.getField()).addListener(new FieldRemoveBOnCloseHandler(this));
                    }
    }
1075788
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
        {
            if (m_fldSource != null) if (m_fldSource.getRecord() != this.getOwner().getRecord())
                m_fldSource.getRecord().addListener(new FileRemoveBOnCloseHandler(this));     // Not same file, if target file closes, remove this listener!
            InitOnceFieldHandler behavior = (InitOnceFieldHandler)this.getOwner().getListener(InitOnceFieldHandler.class.getName());
            if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT)
                behavior = null;    // Special case - if there is a current record, make sure initonce works.
            if (behavior != null)
                behavior.setFirstTime(true);  // If this listener exists it doesn't init initially everything up, so disable for a sec.
            this.syncBehaviorToRecord(null);    // Init now
            if (this.getOwner() instanceof ReferenceField)
                if (this.getOwner().getListener(ReadSecondaryHandler.class.getName()) != null)
                {
                    if (behavior != null)
                        behavior.setEnabledListener(false);  // If this listener exists it doesn't init initially everything up, so disable for a sec.
                    ((FieldListener)this.getOwner().getListener(ReadSecondaryHandler.class.getName())).syncBehaviorToRecord(null);
                }
        }
    }
1188667
protected Future<T> addToListeners(
    final GenericCompletionListener<? extends Future<T>> listener) {
    if (listener == null) {
      throw new IllegalArgumentException("The listener can't be null.");
    }

    synchronized(this) {
      listeners.add(listener);
    }

    if(isDone()) {
      notifyListeners();
    }

    return this;
  }
375905
public void addListener(ComObjectListener listener) {
        if(listener==null)
            throw new IllegalArgumentException("listener is null");
        if(listeners.contains(listener))
            throw new IllegalArgumentException("can't register the same listener twice");
        listeners.add(listener);
    }
369110
public void removeListener(BaseListener listener, boolean bFreeListener)
    {
        if (m_listener != null)
        {
            if (m_listener == listener)
            {
                m_listener = (FieldListener)listener.getNextListener();
                listener.unlink(bFreeListener);     // remove theBehavior from the linked list
            }
            else
                m_listener.removeListener(listener, bFreeListener);
        } // Remember to free the listener after removing it!
    }
1277041
public void addPrimaryListener(InputListener listener) {
		removeListener(listener);
		
		keyListeners.add(0, listener);
		mouseListeners.add(0, listener);
		controllerListeners.add(0, listener);
		
		allListeners.add(listener);
	}
914054
@Override
  public void addListener(final AgentModel.Listener listener) {
    listeners.add(listener);
    listener.tasksChanged(this);
  }
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);
    }
169604
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner != null)
        {
            BaseField field = m_field;
            if (field != null)
                if (field.getRecord() != owner)
            {   // Points to different file... make sure this is removed if the other file is closed
                field.addListener(new FieldRemoveBOnCloseHandler(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");
    }
537423
public void init(ListenerOwner owner)
    {
        m_owner = owner;
        m_nextListener = null;
        m_bEnabled = true;
        m_dependentListener = null;
        m_dependentStateListener = null;
        if (owner != null)
            owner.addListener(this);
    }
754600
public void addListener( IDmListener listener ) {

		if( listener == null ) {
			this.logger.info( "An invalid DM listener failed to be added." );

		} else {
			synchronized( this.dmListeners ) {
				this.dmListeners.add( listener );
			}

			if( this.enableNotifications.get())
				listener.enableNotifications();

			this.logger.info( "The listener '" + listener.getId() + "' is now available in Roboconf's DM." );
		}

		listListeners();
	}
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;
            }
        };

    }
36214
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (owner == null)
            return;
        boolean bEnabledFlag = this.setEnabledListener(true);   // Disabled automatically on setOwner.
        try   {     // Open this table and move to the control record
            if (!this.getOwner().isOpen())
                if (this.isEnabled()) // Not on a slave
                    this.getOwner().open();     // Open the control file
            if (this.getOwner().getEditMode() == Constants.EDIT_NONE)
                if (this.isEnabled()) // Not on a slave
                    this.doNewRecord(true);     // Read the control file
        } catch (DBException ex)   {
            ex.printStackTrace();
        } finally   {
            this.setEnabledListener(bEnabledFlag);  // Set back
        }
    }
168375
@SuppressWarnings("unchecked")
	public void addBeanContextMembershipListener(BeanContextMembershipListener listener)
	{
		if (listener == null)
		{
			throw new NullPointerException();
		}
		synchronized (bcmListeners)
		{
			if (!bcmListeners.contains(listener))
			{
				bcmListeners.add(listener);
			}
		}
	}
791815
public void addBOSHClientConnListener(
            final BOSHClientConnListener listener) {
        if (listener == null) {
            throw(new IllegalArgumentException(NULL_LISTENER));
        }
        connListeners.add(listener);
    }