Notify the management listeners on a filterWrite.
<p/>
NOTE: this starts on the IO thread, but runs a task OFF the thread.
172954
@Override
    public void doSessionClosedListeners() {
        runManagementTask(new Runnable() {
            @Override
            public void run() {
                try {
                    // The particular management listeners change on strategy, so get them here.
                    for (final SessionManagementListener listener : getManagementListeners()) {
                        listener.doSessionClosed(SessionManagementBeanImpl.this);
                    }

                    // XXX should there be a markChanged() here because the session status is now closed?
                    // Or is that covered by the fact we generate a session-closed message?
                } catch (Exception ex) {
                    logger.warn("Error during doSessionClosed session listener notifications:", ex);
                }
            }
        });
    }
1065367
public void notifyMonitors(ProcessInstance processInstance, String event) {
        // notify registered monitors
        Process processVO = getMainProcessDefinition(processInstance);
        Package pkg = PackageCache.getProcessPackage(processVO.getId());
        // runtime context for enablement does not contain hydrated variables map (too expensive)
        List<ProcessMonitor> monitors = MonitorRegistry.getInstance()
                .getProcessMonitors(new ProcessRuntimeContext(pkg, processVO, processInstance,
                        getDataAccess().getPerformanceLevel(), isInService(), new HashMap<>()));
        if (!monitors.isEmpty()) {
            Map<String,Object> vars = new HashMap<>();
            if (processInstance.getVariables() != null) {
                for (VariableInstance var : processInstance.getVariables()) {
                    Object value = var.getData();
                    if (value instanceof DocumentReference) {
                        try {
                            Document docVO = getDocument((DocumentReference) value, false);
                            value = docVO == null ? null : docVO.getObject(var.getType(), pkg);
                        }
                        catch (DataAccessException ex) {
                            logger.severeException(ex.getMessage(), ex);
                        }
                    }
                    vars.put(var.getName(), value);
                }
            }
            ProcessRuntimeContext runtimeContext = new ProcessRuntimeContext(pkg, processVO, processInstance,
                    getDataAccess().getPerformanceLevel(), isInService(), vars);

            for (ProcessMonitor monitor : monitors) {
                try {
                    if (monitor instanceof OfflineMonitor) {
                        @SuppressWarnings("unchecked")
                        OfflineMonitor<ProcessRuntimeContext> processOfflineMonitor = (OfflineMonitor<ProcessRuntimeContext>) monitor;
                        new OfflineMonitorTrigger<>(processOfflineMonitor, runtimeContext).fire(event);
                    }
                    else {
                        if (WorkStatus.LOGMSG_PROC_START.equals(event)) {
                            Map<String,Object> updated = monitor.onStart(runtimeContext);
                            if (updated != null) {
                                for (String varName : updated.keySet()) {
                                    if (processInstance.getVariables() == null)
                                        processInstance.setVariables(new ArrayList<>());
                                    Variable varVO = processVO.getVariable(varName);
                                    if (varVO == null || !varVO.isInput())
                                        throw new ProcessException("Process '" + processVO.getFullLabel() + "' has no such input variable defined: " + varName);
                                    if (processInstance.getVariable(varName) != null)
                                        throw new ProcessException("Process '" + processVO.getFullLabel() + "' input variable already populated: " + varName);
                                    if (VariableTranslator.isDocumentReferenceVariable(runtimeContext.getPackage(), varVO.getType())) {
                                        DocumentReference docRef = createDocument(varVO.getType(), OwnerType.VARIABLE_INSTANCE, new Long(0),
                                                updated.get(varName));
                                        VariableInstance varInst = createVariableInstance(processInstance, varName, docRef);
                                        updateDocumentInfo(docRef, processVO.getVariable(varInst.getName()).getType(), OwnerType.VARIABLE_INSTANCE,
                                                varInst.getInstanceId(), null, null);
                                        processInstance.getVariables().add(varInst);
                                    }
                                    else {
                                        VariableInstance varInst = createVariableInstance(processInstance, varName, updated.get(varName));
                                        processInstance.getVariables().add(varInst);
                                    }
                                }
                            }
                        }
                        else if (WorkStatus.LOGMSG_PROC_ERROR.equals(event)) {
                            monitor.onError(runtimeContext);
                        }
                        else if (WorkStatus.LOGMSG_PROC_COMPLETE.equals(event)) {
                            monitor.onFinish(runtimeContext);
                        }
                    }
                }
                catch (Exception ex) {
                    logger.severeException(ex.getMessage(), ex);
                }
            }
        }
    }
1291772
private void notifyListenersAfterWrite(ModbusMessage msg) {
        synchronized (listeners) {
            for (AbstractSerialTransportListener listener : listeners) {
                listener.afterMessageWrite(commPort, msg);
            }
        }
    }
219878
private void notifyListeners(List<PipelineTimelineEntry> newEntries) {
        Map<CaseInsensitiveString, PipelineTimelineEntry> pipelineToOldestEntry = new HashMap<>();
        for (PipelineTimelineEntry challenger : newEntries) {
            CaseInsensitiveString pipelineName = new CaseInsensitiveString(challenger.getPipelineName());
            PipelineTimelineEntry champion = pipelineToOldestEntry.get(pipelineName);
            if (champion == null || challenger.compareTo(champion) < 0) {
                pipelineToOldestEntry.put(pipelineName, challenger);
            }
        }

        for (TimelineUpdateListener listener : listeners) {
            for (Map.Entry<CaseInsensitiveString, PipelineTimelineEntry> entry : pipelineToOldestEntry.entrySet()) {
                try {
                    listener.added(entry.getValue(), naturalOrderPmm.get(entry.getKey()));
                } catch (Exception e) {
                    LOGGER.warn("Ignoring exception when notifying listener: {}", listener, e);
                }
            }
        }
    }
948974
@Override
    public void doSessionCreatedListeners(final long sessionId, final ManagementSessionType managementSessionType) {
        runManagementTask(new Runnable() {
            @Override
            public void run() {
                try {
                    // The particular management listeners change on strategy, so get them here.
                    for (final GatewayManagementListener listener : getManagementListeners()) {
                        listener.doSessionCreated(GatewayManagementBeanImpl.this, sessionId);
                    }

                    markChanged();  // mark ourselves as changed, possibly tell listeners
                } catch (Exception ex) {
                    logger.warn("Error during sessionCreated gateway listener notifications:", ex);
                }
            }
        });
    }
423274
public void notifyMonitors(ProcessInstance processInstance, String event) {
        TransactionWrapper transaction = null;
        try {
            transaction = startTransaction();
            engineImpl.notifyMonitors(processInstance, event);
        }
        catch (Exception ex) {
            // do not stop processing due to notification failure
            LoggerUtil.getStandardLogger().severeException(ex.getMessage(), ex);
        }
        finally {
            try {
                stopTransaction(transaction);
            }
            catch (DataAccessException ex) {
                LoggerUtil.getStandardLogger().severeException(ex.getMessage(), ex);
            }
        }
    }
625311
private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
                                                                       NotificationFilter filter, Object handback) {
        Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
        safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
    }
703384
void announceMPStarted(int startMode)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "announceMPStarted");

        DestinationTypeFilter destFilter = new DestinationTypeFilter();
        SIMPIterator itr = destinationIndex.iterator(destFilter);
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.announceMPStarted();
        }
        itr.finished();

        LinkTypeFilter linkFilter = new LinkTypeFilter();
        linkFilter.LOCAL = Boolean.TRUE;
        itr = linkIndex.iterator(linkFilter);
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.announceMPStarted();
        }
        itr.finished();

        itr = foreignBusIndex.iterator();
        while (itr.hasNext())
        {
            DestinationHandler dh = (DestinationHandler) itr.next();
            dh.announceMPStarted();
        }
        itr.finished();

        // Iterate over the MQLinks, calling the MQLink component to
        // alert it that MP has started
        LinkTypeFilter mqLinkFilter = new LinkTypeFilter();
        mqLinkFilter.MQLINK = Boolean.TRUE;
        itr = linkIndex.iterator(mqLinkFilter);
        while (itr.hasNext())
        {
            MQLinkHandler mqLinkHandler = (MQLinkHandler) itr.next();
            try
            {
                mqLinkHandler.
                                announceMPStarted(startMode,
                                                  messageProcessor.getMessagingEngine());
            } catch (SIResourceException e)
            {
                // No FFDC code needed

                SibTr.exception(tc, e);

                // The MQLink component will have FFDC'd we'll trace
                // the problem but allow processing to continue
            } catch (SIException e)
            {
                // No FFDC code needed

                SibTr.exception(tc, e);

                // The MQLink component will have FFDC'd we'll trace
                // the problem but allow processing to continue
            }
        }
        itr.finished();

        //Allow the async deletion thread to start up now if it wants.
        setIsAsyncDeletionThreadStartable(true);

        // Explicitly start the async deletion thread if there is anything to do.
        startAsynchDeletion();

        //start DeletePubSubMsgsThread.
        startDeletePubSubMsgsThread();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "announceMPStarted");
    }
769177
@Override
    public void setWriteListener(WriteListener appWLObject) {
        //Throw a NullPointerException if the WriteListener passed in was null
        if(appWLObject == null){            

            Tr.error(tc, "writelistener.is.null");  
            throw new NullPointerException(Tr.formatMessage(tc, "writelistener.is.null"));
        } 
        if(_outHelper.isOutputStream_closed() || _outHelper.isOutputStream_close_initiated_but_not_Flush_ready()){
            Tr.error(tc, "stream.is.closed.no.read.write");                         
            throw new IllegalStateException(Tr.formatMessage(tc, "stream.is.closed.no.read.write"));           
        }
        //Throw an IllegalStateException is there was already a WriteListener set for this InputStream
        if(this._listener != null){            
            Tr.error(tc, "writelistener.already.started");                         
            throw new IllegalStateException(Tr.formatMessage(tc, "writelistener.already.started"));
        } 
        this._listener = appWLObject;        
        //Create the ThreadContextManager to save off the threads information to pass onto new threads
        ThreadContextManager tcm = new ThreadContextManager();
        //Create a new callback
        this.callback = new UpgradeAsyncWriteCallback(this._listener, this , tcm, _outHelper._upConn);                         
        _outHelper.setWriteListenerCallBack(callback);
        _outHelper.set_listener(_listener);

        //Create the WriteListenerRunnable to call onWritePossible on a new thread
        UpgradeWriteListenerRunnable wlRunnable = new UpgradeWriteListenerRunnable(this._listener, this , tcm, callback);

        // make sure no more write allowed on this Thread as this set
        // WriteListener.
        WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
//        reqState.setAttribute("com.ibm.ws.webcontainer.upgrade.ThisThreadSetWL", true);
        reqState.removeAttribute("com.ibm.ws.webcontainer.upgrade.WriteAllowedonThisThread");

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
            Tr.debug(tc, "setWriteListener: start new thread with wlRunnable");
        }

        try {
            com.ibm.ws.webcontainer.osgi.WebContainer.getExecutorService().execute(wlRunnable);
        } catch (Exception e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                Tr.debug(tc, "setWriteListener: An exception occurred during the execute : " + e);
            }
            this.callback.error(_outHelper.get_vc(), e);                
        }


    }
1350477
protected final void notifyListeners() {
        Iterator<SMTPClientFutureListener<E>> it = null;
        synchronized (this) {
            if (listeners != null) {
                // notify the listeners
                it  = listeners.iterator();

                listeners = null;
            }
        }
        if (it != null) {
            while(it.hasNext()) {
                SMTPClientFutureListener<E> listener = null;
                try {
                    listener = it.next();
                    listener.operationComplete(this);
                } catch (Throwable e) {
                    LOGGER.warn("Exception thrown while executing " + SMTPClientFutureListener.class.getName() + " " + listener, e);
                }
            }
        }
    }
649466
private <T> void manageSubscription(EventStream<T> stream, Consumer<T> consumer) {
        manageSubscription(stream.subscribe(consumer));
    }
1353188
protected void onRemoved() {
        List<FilterChangeListener> listeners = getAllListeners();
        for (FilterChangeListener listener : listeners) {
            listener.onRemove(this);
        }
    }
310820
@Override
    public void doSessionCreatedListeners() {
        runManagementTask(new Runnable() {
            @Override
            public void run() {
                try {
                    // The particular management listeners change on strategy, so get them here.
                    for (final SessionManagementListener listener : getManagementListeners()) {
                        listener.doSessionCreated(SessionManagementBeanImpl.this);
                    }

                    // XXX Should we include a 'markChanged()' here?
                } catch (Exception ex) {
                    logger.warn("Error during doSessionCreated session listener notifications:", ex);
                }
            }
        });
    }
878812
public synchronized void notifyFileSubscribers(ReloadableFile reloadableFile) {
        notifyDefaultFileSubscribers();

        IdentificationSet<FileSubscriber> subList = fileSubscribers.get(reloadableFile);
        if (subList == null) {
            return;
        }

        for (FileSubscriber sub : subList) {
            CompletableFuture.runAsync(sub::update, main.getThreadPoolManager().getAddOnsThreadPool());
        }
    }
282627
@Override
    public void filterWrite(final NextFilter nextFilter,
            final IoSession session, final WriteRequest writeRequest) {
        writeData(nextFilter, session, writeRequest, false);
    }
363495
private boolean notifyOnPrevious(final int index) {
        boolean result = true;

        for (WizardListener listener : wizardListeners) {
            result &= listener.onPrevious(index, viewPagerAdapter.getItem(index));
        }

        return result;
    }
59225
def notify_listeners(self, msg_type, params):
        """"""
        for c in self.listeners:
            c.notify(msg_type, params)