If there is another RecordMessageFilter supplying messages to this listener, remove it.
This typically fixes the problem in TableModelSession where a grid listener is added for the session and then also when thin needs a listener
@param listenerToCheck
518283
public void removeDuplicateFilters(JMessageListener listenerToCheck)
    {
        for (int iIndex = 0; ; iIndex++)
        {
            BaseMessageFilter filter = listenerToCheck.getListenerMessageFilter(iIndex);
            if (filter == null)
                break;
            if (this.isSameFilter(filter))
            {
                if (filter.getMessageListener(1) == null)
                {   // Only free if the message list is the same and only
                    filter.removeFilterMessageListener(listenerToCheck);
                // DO NOT free the listener.
                    filter.free();     // Cool, it was a dup... get rid of it.
                    iIndex--;
                }
            }
        }
    }
345563
@FFDCIgnore(Exception.class) //manually logged or is NoSuchElementException which we want to ignore
    private void processInvalidListeners() {
        final boolean trace = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();

        String appName = getIStore().getId();

        long start = System.currentTimeMillis();

        if (trace && tc.isDebugEnabled())
            tcInvoke(tcSessionMetaCache, "iterator");

        @SuppressWarnings("rawtypes")
        Iterator<Cache.Entry<String, ArrayList>> it = sessionMetaCache.iterator();

        if (trace && tc.isDebugEnabled())
            tcReturn(tcSessionMetaCache, "iterator", it);

        while (it.hasNext()) {
            if (trace && tc.isDebugEnabled())
                tcInvoke(tcSessionMetaCache, "_iterator.next");

            @SuppressWarnings("rawtypes")
            Cache.Entry<String, ArrayList> entry;
            try {
                entry = it.next();
            } catch (NoSuchElementException x) {
                // ignore - some JCache providers might raise this instead of returning null when modified during iterator
                entry = null;
            }
            String id = entry == null ? null : entry.getKey();
            ArrayList<?> value = id == null ? null : entry.getValue();

            if (trace && tc.isDebugEnabled())
                tcReturn(tcSessionMetaCache, "_iterator.next", id, value);

            if (id != null && !INVAL_KEY.equals(id)) {
                SessionInfo sessionInfo = new SessionInfo(value);
                long lastAccess = sessionInfo.getLastAccess();
                short listenerTypes = sessionInfo.getListenerTypes();
                int maxInactive = sessionInfo.getMaxInactiveTime();
                if ((listenerTypes & BackedSession.HTTP_SESSION_BINDING_LISTENER) != 0 // sessions that DO have binding listeners
                                && maxInactive >= 0
                                && maxInactive < (start - lastAccess) / 1000) {

                    if (trace && tc.isDebugEnabled())
                        Tr.debug(this, tc, "processInvalidListeners for sessionID=" + id);

                    CacheSession session = new CacheSession(this, id, _iStore.getStoreCallback());
                    session.initSession(_iStore);
                    session.setIsValid(true);
                    session.setIsNew(false);
                    session.updateLastAccessTime(lastAccess);
                    session.setCreationTime(sessionInfo.getCreationTime());
                    session.internalSetMaxInactive(maxInactive);
                    session.internalSetUser(sessionInfo.getUser());
                    session.setListenerFlag(listenerTypes);

                    long now = System.currentTimeMillis();
                    //handle the subset of session listeners

                    lastAccess = session.getCurrentAccessTime(); // try using lastTouch again..

                    try {
                        // get the session ready and read in any listeners
                        session.setIsNew(false);
                        session.getSwappableListeners(BackedSession.HTTP_SESSION_BINDING_LISTENER);

                        sessionInfo = sessionInfo.clone();
                        sessionInfo.setLastAccess(lastAccess);

                        // only invalidate those which have not been accessed since
                        // check in computeInvalidList

                        ArrayList<Object> list = sessionInfo.getArrayList();

                        if (trace && tc.isDebugEnabled())
                            tcInvoke(tcSessionMetaCache, "remove", id, list);

                        boolean removed = sessionMetaCache.remove(id, list);

                        if (trace && tc.isDebugEnabled())
                            tcReturn(tcSessionMetaCache, "remove", removed);

                        if (removed) {
                            // return of session done as a result of this call
                            session.internalInvalidate(true);

                            Set<String> propIds = sessionInfo.getSessionPropertyIds();
                            if (propIds != null && !propIds.isEmpty()) {
                                HashSet<String> propKeys = new HashSet<String>();
                                for (String propId : propIds)
                                    propKeys.add(createSessionAttributeKey(id, propId));

                                if (trace && tc.isDebugEnabled())
                                    tcInvoke(tcSessionAttrCache, "removeAll", propKeys);

                                sessionAttributeCache.removeAll(propKeys);

                                if (trace && tc.isDebugEnabled())
                                    tcReturn(tcSessionAttrCache, "removeAll");
                            }
                        }

                        /*
                         * we don't want to update this on every invalidation with a listener that is processed.
                         * We'll only update this if we're getting close.
                         *
                         * Processing Invalidation Listeners could take a long time. We should update the
                         * NukerTimeStamp so that another server in this cluster doesn't kick off invalidation
                         * while we are still processing. We only want to update the time stamp if we are getting
                         * close to the time when it will expire. Therefore, we are going to do it after we're 1/2 way there.
                         */
                        if ((now + _smc.getInvalidationCheckInterval() * (1000 / 2)) < System.currentTimeMillis()) {
                            updateNukerTimeStamp(appName);
                            now = System.currentTimeMillis();
                        }
                    } catch (Exception e) {
                        FFDCFilter.processException(e, getClass().getName(), "652", this, new Object[] { session });
                        throw e;
                    }
                }
            }
        }
    }
964041
public void removeServiceInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) {
        ServiceInstanceUtils.validateServiceName(serviceName);
        if (listener == null) {
            throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
                    ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
                    "ServiceInstanceChangeListener");
        }
        List<InstanceChangeListener<ModelServiceInstance>> list = changeListenerMap.get(serviceName);
        if (list != null) {
            boolean found = false;
            for (InstanceChangeListener<ModelServiceInstance> l : list) {
                if (l instanceof ServiceInstanceChangeListenerAdapter
                        && ((ServiceInstanceChangeListenerAdapter) l).getAdapter() == listener) {
                    list.remove(l);
                    found = true;
                    break;
                }
            }
            if (!found) {
                LOGGER.error(ErrorCode.SERVICE_INSTANCE_LISTENER_DOES_NOT_EXIST.getMessageTemplate());
            }
            if (list.isEmpty()) {
                changeListenerMap.remove(serviceName);
            }
        } else {
            LOGGER.error(String.format(ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(), serviceName));
        }

    }
824276
public void removeConnectionEventListener(ConnectionEventListener listener) {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn && tc.isEntryEnabled()) 
            Tr.entry(this, tc, "removeConnectionEventListener", listener);

        if (listener == null) {
            NullPointerException nullX = new NullPointerException(
                            "Cannot remove null ConnectionEventListener.");

            if (isTraceOn && tc.isEntryEnabled())
                Tr.exit(this, tc, "removeConnectionEventListener", nullX); 
            throw nullX; 
        }

        // setting the metrics to null here causes a NPE the metrics cannot be set to null
        // until the end of the destroy method.

        // Not synchronized because of the contract that add/remove event listeners will only
        // be used on ManagedConnection create/destroy, when the ManagedConnection is not
        // used by any other threads. 

        // Find matching listener in the array -- then remove it, adjust entries as
        // necessary, and adjust the counter

        // loop through the listeners
        for (int i = 0; i < numListeners; i++)
            // look for matching listener
            if (listener == ivEventListeners[i]) {
                // remove the matching listener, but don't leave a gap in the array -- the order of
                // the listeners in the array doesn't matter, so move the last listener to fill the
                // gap left by the remove, if necessary
                ivEventListeners[i] = ivEventListeners[--numListeners];
                ivEventListeners[numListeners] = null;

                if (isTraceOn && tc.isEntryEnabled())
                    Tr.exit(this, tc, "removeConnectionEventListener"); 
                return;
            }

        if (isTraceOn && tc.isEntryEnabled()) 
            Tr.exit(this, tc, "removeConnectionEventListener", "Listener not found for remove.");
    }
235285
void deleteNoRefCheck(Session session, Row row) {

        Object[] data = row.getData();

        fireBeforeTriggers(session, Trigger.DELETE_BEFORE, data, null, null);

        if (isView) {
            return;
        }

        deleteNoCheck(session, row);
    }
95886
public void removeListener(UserTransactionListener listener)
   {
      UserTransactionListenerImpl impl = listeners.get(listener);

      if (impl != null)
      {
         delegator.removeListener(impl);
         listeners.remove(listener);
      }
   }
797741
public void removeEventSourceListener(EventSourceListener listener) {
        LOG.entering(CLASS_NAME, "removeEventSourceListener", listener);
        _getDelegate().removeEventSourceListener(listener);
    }
1284691
public void removeListener(AnimatorListener listener) {
        if (mListeners == null) {
            return;
        }
        mListeners.remove(listener);
        if (mListeners.size() == 0) {
            mListeners = null;
        }
    }
1352134
public void freeListenersWithSource(Object objSource)
    {
        Object[] rgFilter = m_mapFilters.values().toArray();
        for (int i = 0; i < rgFilter.length; i++)
        {
            BaseMessageFilter filter = (BaseMessageFilter)rgFilter[i];
            if (filter.getMessageSource() == objSource)
            {
                while (filter.getMessageListener(0) != null)
                {
                    JMessageListener listener = filter.getMessageListener(0);
                    filter.removeFilterMessageListener(listener);
                    if (listener instanceof Freeable)
                        ((Freeable)listener).free();
                }                
            }
        }
    }
1284896
public void removeListener(ILabelProviderListener listener)
	{
		if (fLabelDecorators != null)
		{
			for (int i = 0; i < fLabelDecorators.size(); i++)
			{
				ILabelDecorator decorator = (ILabelDecorator) fLabelDecorators.get(i);
				decorator.removeListener(listener);
			}
		}
		fListeners.remove(listener);
	}
248327
public void addListenerMessageFilter(BaseMessageFilter messageFilter)
    {
        if (m_messageFilterList == null)
            m_messageFilterList = new MessageListenerFilterList(this);
        m_messageFilterList.addMessageFilter(messageFilter);
    }
477379
@Override
    public void addEventListener(EventListener listener) {
        if (listener instanceof SessionListener) {
            sessionListeners.add((SessionListener)listener);
        }
        if (listener instanceof SessionAttributeListener) {
            sessionAttributeListeners.add((SessionAttributeListener)listener);
        }
    }
1362797
public <T extends Widget & Checkable> boolean addOnCheckChangedListener
            (OnCheckChangedListener listener) {
        final boolean added;
        synchronized (mListeners) {
            added = mListeners.add(listener);
        }
        if (added) {
            List<T> c = getCheckableChildren();
            for (int i = 0; i < c.size(); ++i) {
                listener.onCheckChanged(this, c.get(i), i);
            }
        }
        return added;
    }
644208
protected void removeDestinationListener(DestinationListener destinationListener)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "removeDestinationListener", new Object[] { destinationListener });

        synchronized (this)
        {
            for (int i = 0; i < destinationListeners.size(); i++)
            {
                DestinationListenerDataObject listenerDataObject = destinationListeners.get(i);
                if (destinationListener.equals(listenerDataObject.getDestinationLister()))
                {
                    destinationListeners.remove(listenerDataObject);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "removeDestinationListener");
    }
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();
	}
958523
public void deleteNoCheckFromLog(Session session, Object[] data) {

        Row             row   = null;
        PersistentStore store = session.sessionData.getRowStore(this);

        if (hasPrimaryKey()) {
            RowIterator it = getPrimaryIndex().findFirstRow(session, store,
                data, primaryKeyColsSequence);

            row = it.getNextRow();
        } else if (bestIndex == null) {
            RowIterator it = rowIterator(session);

            while (true) {
                row = it.getNextRow();

                if (row == null) {
                    break;
                }

                if (IndexAVL.compareRows(
                        row.getData(), data, defaultColumnMap,
                        colTypes) == 0) {
                    break;
                }
            }
        } else {
            RowIterator it = bestIndex.findFirstRow(session, store, data);

            while (true) {
                row = it.getNextRow();

                if (row == null) {
                    break;
                }

                Object[] rowdata = row.getData();

                // reached end of range
                if (bestIndex.compareRowNonUnique(
                        data, bestIndex.getColumns(), rowdata) != 0) {
                    row = null;

                    break;
                }

                if (IndexAVL.compareRows(
                        rowdata, data, defaultColumnMap, colTypes) == 0) {
                    break;
                }
            }
        }

        if (row == null) {
            return;
        }

        deleteNoCheck(session, row);
    }
337039
public void removeListener(InvalidationListener listener) {
        synchronized (hsInvalidationListeners) {
            hsInvalidationListeners.remove(listener);
            invalidationListenerCount = hsInvalidationListeners.size();
            bUpdateInvalidationListener = true;
        }
    }