internal method for assigning a message listener
976822
private void setAsyncListener(MessageListener listener) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setAsyncListener", listener);

        consumer = new Consumer(listener, session, sessionAckMode);
        try {
            // ConsumerSession must be stopped to register the callback
            coreConsumerSession.stop();
            int batchSize = 1;
            boolean deliverImmediately = false;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Registering async callback for consumer" + consumer);
            // the register call will replace any existing callback, so no need for
            // separate deregister call.
            coreConsumerSession.registerAsynchConsumerCallback(consumer,
                                                               0, // maxActiveMessages - no limit
                                                               0, // messageLockExpiry - no expiry
                                                               batchSize,
                                                               session.getOrderingContext()
                            );

            // Deal with the case where the listener is set after the connection
            // is started. Note that this will handle the restarting of the core
            // consumer session if we paused it earlier in this block.
            if (session.getState() == STARTED)
                coreConsumerSession.start(deliverImmediately);
        } catch (SIIncorrectCallException sie) {
            // No FFDC code needed
            // d222942 review. Default message ok.
            // d238447 FFDC Review. FFDC here, see comment in next catch for more detail.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0085",
                                                            new Object[] { sie, "JmsMsgConsumerImpl.setAsyncListener" },
                                                            sie,
                                                            "JmsMsgConsumerImpl.setAsyncListener#1",
                                                            this,
                                                            tc);
        } catch (SIException sie) {
            // No FFDC code needed
            // The exceptions thrown by stop, registerAsynchConsumerCallback and start are mostly
            // the "connection lost" family. registerAsynchConsumerCallback can also throw an
            // SIIncorrectCallException if the coreConsumerSession hasn't been stopped, but that
            // shouldn't be possible in the code above. Default message ok.
            // d238447 FFDC Review. SIIncorrectCall separated into its own catch block above,
            //   no FFDCs for this group.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0085",
                                                            new Object[] { sie, "JmsMsgConsumerImpl.setAsyncListener" },
                                                            sie,
                                                            null, // null probeId = no FFDC
                                                            this,
                                                            tc);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setAsyncListener");
    }
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);
                }
            }
        }
    }
507797
public void addListener(EventListener l) {
        if (l == null) {
            throw new NullPointerException();
        }

        if (acceptsListener(l)) {
            synchronized (notifyLock) {
                if (listeners == null) {
                    listeners = new ArrayList<EventListener>();
                } else {
                    // identity equality check
                    for (EventListener ll : listeners) {
                        if (ll == l) {
                            return;
                        }
                    }
                }

                listeners.add(l);
            }
        } else {
            throw new IllegalStateException("Listener invalid for this notifier.");
        }
    }
59225
def notify_listeners(self, msg_type, params):
        """"""
        for c in self.listeners:
            c.notify(msg_type, params)
1321984
public void initListeners() {
        instanceStateChangedListener.watch(ChangedType.UPDATED);
        dataSourceStateChangedListener.watch(ChangedType.UPDATED, ChangedType.DELETED);
    }
682986
public void addListener (Telegraph listener, int msg) {
		Array<Telegraph> listeners = msgListeners.get(msg);
		if (listeners == null) {
			// Associate an empty unordered array with the message code
			listeners = new Array<Telegraph>(false, 16);
			msgListeners.put(msg, listeners);
		}
		listeners.add(listener);

		// Dispatch messages from registered providers
		Array<TelegramProvider> providers = msgProviders.get(msg);
		if (providers != null) {
			for (int i = 0, n = providers.size; i < n; i++) {
				TelegramProvider provider = providers.get(i);
				Object info = provider.provideMessageInfo(msg, listener);
				if (info != null) {
					Telegraph sender = ClassReflection.isInstance(Telegraph.class, provider) ? (Telegraph)provider : null;
					dispatchMessage(0, sender, listener, msg, info, false);
				}
			}
		}
	}
1331844
def construct_listener(outfile=None):
    """"""
    if outfile is not None:
        if os.path.exists(outfile):
            raise IOError("File %s already exists" % outfile)
        
        outfile = open(outfile, 'wb')

    return PrintingListener(out=outfile)
1069578
private void createListener(final SibRaMessagingEngineConnection connection)
            throws ResourceException {

        final String methodName = "createListener";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, connection);
        }

        final SIDestinationAddress destination = _endpointConfiguration
                .getDestination();

        try {

            connection.createListener(destination, _messageEndpointFactory);

        } catch (final IllegalStateException exception) {

            // No FFDC code needed
            throw exception;

        } catch (final ResourceException exception) {

            // No FFDC code needed

            if (_remoteDestination) {

                SibTr.warning(TRACE, SibTr.Suppressor.ALL_FOR_A_WHILE_SIMILAR_INSERTS, "ATTACH_FAILED_CWSIV0769", new Object[] {
                        destination.getDestinationName(),
                        _endpointConfiguration.getBusName(), this, exception });

                /*
                 * Try again 30 seconds later
                 */

                _timer.schedule(new TimerTask() {

                    public void run() {

                        try {

                            createListener(connection);

                        } catch (final ResourceException retryException) {
                            // No FFDC code needed
                        }

                    }
                }, RETRY_INTERVAL);

            } else {

                throw exception;

            }

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
1276771
private void notifyListeners(IMessagingClientFactory factory, boolean isAdded) {

		for (MessagingClientFactoryListener listener : this.listeners) {
			try {
				if (isAdded)
					listener.addMessagingClientFactory(factory);
				else
					listener.removeMessagingClientFactory(factory);

			} catch (Throwable t) {
				// Log the exception, but *do not* interrupt the notification of the other listeners.
				this.logger.warning("Messaging client factory listener has thrown an exception: " + listener);
				Utils.logException(this.logger, new RuntimeException(t));
			}
		}
	}
1193215
public void init(BaseMessage message, Object objRawMessage)
    {
        m_message = message;
        if (message != null)
            message.setExternalMessage(this);
        if (objRawMessage != null)
            this.setRawData(objRawMessage);
    }
701129
void onReceive(int register, byte[] message) {
        I2CEvent evt = new I2CEvent(this, register, message);
        I2CListener listener = callbacks.remove(register);
        if (listener == null) {
            for (I2CListener subscriber : subscribers) {
                subscriber.onReceive(evt);
            }
        } else {
            listener.onReceive(evt);
        }
    }
329031
void notifyListener() {
        Node<K, V> node;
        while ((node = pendingNotifications.poll()) != null) {
            listener.onEviction(node.key, node.getValue());
        }
    }
181695
public void addListeners()
    {
        super.addListeners();
        
        if (this.isContactDisplay())
        {
            ReferenceField field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID);
            field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageInfoType.REQUEST));
            field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID);
            field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageType.MESSAGE_OUT));
            field = (ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID);
            field.setValue(field.getReferenceRecord(this).getIDFromCode(MessageStatus.SENT));
        }
        
        this.getMainRecord().getKeyArea().setKeyOrder(DBConstants.DESCENDING);
        
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.REFERENCE_TYPE), this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.REFERENCE_TYPE).addListener(new FieldReSelectHandler(this));
        
        this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_INFO_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_INFO_TYPE_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TYPE_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TYPE_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_STATUS_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_STATUS_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TRANSPORT_ID), this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.MESSAGE_TRANSPORT_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.USER_ID), this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID), DBConstants.EQUALS, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.USER_ID).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE), CompareFileFilter.GREATER_THAN_EQUAL, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.START_DATE).addListener(new FieldReSelectHandler(this));
        this.getMainRecord().addListener(new CompareFileFilter(this.getMainRecord().getField(MessageLog.MESSAGE_TIME), this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE), CompareFileFilter.LESS_THAN_EQUAL, null, true));
        this.getScreenRecord().getField(MessageLogScreenRecord.END_DATE).addListener(new FieldReSelectHandler(this));
        
        this.setEditing(false);
    }
332976
function listener(message, sender) {
			var messageEvent = new MessageEvent({
				data: message,
				origin: sender.tab ? sender.tab.url : sender.url
			})
			if (
				('sourceChannel' in messageEvent)
				&& ('key' in messageEvent)
				&& transport.name === messageEvent.sourceChannel //events on the same channel
				&& transport.key !== messageEvent.key //skip returned back events
			) {
				handler(messageEvent)
			}
		}
1064156
function onFinished (msg, listener) {
  if (isFinished(msg) !== false) {
    defer(listener, null, msg)
    return msg
  }

  // attach the listener to the message
  attachListener(msg, listener)

  return msg
}
1291772
private void notifyListenersAfterWrite(ModbusMessage msg) {
        synchronized (listeners) {
            for (AbstractSerialTransportListener listener : listeners) {
                listener.afterMessageWrite(commPort, msg);
            }
        }
    }
1123026
function(oEvent) {
			var sEventId = oEvent.getParameter("EventId");

			if (sEventId === "messageSelected") {
				if (oEvent.getParameter("type") === "listenerAttached") {
					this._bEnableMessageSelect = true;
				} else if (oEvent.getParameter("type") === "listenerDetached") {
					this._bEnableMessageSelect = false;
				}

				this.fireEvent("_enableMessageSelect", {
					enabled : this._bEnableMessageSelect,
					notifier : this
				});
			}
		}