traverses list of listeners and executes their calls
768797
public function notifyListeners() {

        foreach ($this->listeners as $listener) {

            $listenerClass = $listener['listener'];
            $handler = array($listenerClass, 'on_' . $this->state);
            if(!class_exists($listenerClass)) {
                throw new \Exception($listenerClass . ' does not exist');
            }

            if ($this->state == $listener['event'] && is_callable($handler)) {
                unset($listener['listener']);     
                
                $eventListener = new $listenerClass($this->logger, $this->request, $this->response);
                $eventListener->setDatasources($this->datasourceFactory, $this->datasources);
                $eventListener->setDatasourceKey($this->datasourceKey);
                $eventListener->setEventDispatcher($this->eventDispatcher);
                $eventListener->setConfig($listener);
                $eventListener->setCacheManager($this->cacheManager);
                $eventListener->setContainer($this->container);

                $eventListener->execute($this->state, $this->event);

            }
        }
      
     
    }
331217
private synchronized void initializeListeners()
    {
        if (this.listenersByName == null) {
            this.listenersByEvent = new ConcurrentHashMap<>();
            this.listenersByName = new ConcurrentHashMap<>();

            // Can be null in unit tests
            if (this.componentManager != null) {
                try {
                    for (EventListener listener : this.componentManager
                        .<EventListener>getInstanceList(EventListener.class)) {
                        addListener(listener);
                    }
                } catch (ComponentLookupException e) {
                    this.logger.error("Failed to lookup listeners", e);
                }
            }
        }
    }
1313052
public static void forEachMethods(TypeElement typeElement, MethodFoundListener listener) {
		Elements elementUtils = BaseProcessor.elementUtils;
		List<? extends Element> list = elementUtils.getAllMembers(typeElement);

		for (Element item : list) {
			if (item.getKind() == ElementKind.METHOD) {
				listener.onMethod((ExecutableElement) item);
			}
		}
	}
852173
def attach(self, listener):
        
        if listener not in self.listeners:
            self.listeners.append(listener)
321278
function emitDone(rawArgs) {
		if(EventEmitter.listenerCount(emitter, "done") > 0) {
			var args = new Array(rawArgs.length + 1);
			args[0] = "done";
			for(var i = 0; i < rawArgs.length; i++)
				args[i + 1] = rawArgs[i];
			process.nextTick(function() {
				emitter.emit.apply(emitter, args);
			});
		}
	}
73782
function (events, func) {
    for (var i = 0; i < events.length; i++) {
      obj.once(events[i], func)
      listeners[events[i]] = func
    }
  }
757520
private <T> void invoke(Map<Object, Set<Method>> methods, T instance) {
        for (Map.Entry<Object, Set<Method>> entry : methods.entrySet()) {
            Object listener = entry.getKey();
            Set<Method> listenerMethods = entry.getValue();
            if (listenerMethods != null) {
                for (Method method : listenerMethods) {
                    Class<?> parameterType = method.getParameterTypes()[0];
                    if (parameterType.isAssignableFrom(instance.getClass())) {
                        try {
                            method.invoke(listener, instance);
                        } catch (IllegalAccessException e) {
                            throw new XOException("Cannot access instance listener method " + method.toGenericString(), e);
                        } catch (InvocationTargetException e) {
                            throw new XOException("Cannot invoke instance listener method " + method.toGenericString(), e);
                        }
                    }
                }
            }
        }
    }
1140432
function filterListeners (listenerCollection) {
        return function(filters) {
            var handlers = [];

            _.each(listenerCollection, function(listener){
                handlers = handlers.concat( findMatch(filters, listener) );
            });

            return handlers;
        };
    }
564438
def _run_callbacks(self):
        """"""
        for i in range(len(self._callbacks)):
            callback, args = self._callbacks.popleft()
            try:
                callback(*args)
            except Exception:
                self._log.exception('Ignoring exception in callback:')
1183100
function() {
        self.tasksCount = 0;
        var list = [], i = 0;
        for(var t in self) {
            if( typeof(self[t]) == 'function') {
                list[i] = {
                    func: self[t],
                    cb: hasCallback(self[t])
                }
                ++i
            }
        }
        run(list)
    }
773193
protected void doExecuteListener(Session session, List<Message> messages) throws JMSException {
        if (!isAcceptMessagesWhileStopping() && !isRunning()) {
            if (logger.isWarnEnabled()) {
                logger.warn("Rejecting received messages because of the listener container "
                        + "having been stopped in the meantime: " + messages);
            }
            rollbackIfNecessary(session);
            throw new MessageRejectedWhileStoppingException();
        }

        try {
            for (Message message : messages) {
                invokeListener(session, message);
            }
        } catch (JMSException ex) {
            rollbackOnExceptionIfNecessary(session, ex);
            throw ex;
        } catch (RuntimeException ex) {
            rollbackOnExceptionIfNecessary(session, ex);
            throw ex;
        } catch (Error err) {
            rollbackOnExceptionIfNecessary(session, err);
            throw err;
        }
        commitIfNecessary(session, messages);
    }
944996
function (node, property, recursive, listeners) {
        // add property specific recursive listeners
        listeners = __appendListeners(node[__getListenerMetaName(property, true)], listeners);
        if (!recursive) {
            // add property specific non-recursive listeners
            listeners = __appendListeners(node[__getListenerMetaName(property)], listeners);
        }
        return listeners;
    }
620787
public void     forEach(final Function<T, Void> function)
    {
        for ( final ListenerEntry<T> entry : listeners.values() )
        {
            entry.executor.execute
            (
                new Runnable()
                {
                    @Override
                    public void run()
                    {
                        try
                        {
                            function.apply(entry.listener);
                        }
                        catch ( Throwable e )
                        {
                            log.error(String.format("Listener (%s) threw an exception", entry.listener), e);
                        }
                    }
                }
            );
        }
    }
661333
function( target, type, listenerFunction ) {
            eventListenerList.push( { target:target, type:type, listener:listenerFunction } );
        }
718789
private void executeHandlers(List<Event> filteredEvents) {
        for (EventHandler current : eventHandlers) {
            for (Event event : filteredEvents) {
                current.handleEvent(event);
            }
        }
    }
705750
public void processOpCall(CustomOp op) {
        // total number of invocations
        invocationsCount.incrementAndGet();

        // number of invocations for this specific op
        opCounter.incrementCount(op.opName());

        // number of invocations for specific class
        String opClass = getOpClass(op);
        classCounter.incrementCount(opClass);


        lastZ = 0;
        prevOpMatching = opClass;
        prevOpMatchingDetailed = opClass + " " + op.opName();
        prevOpMatchingInverted = opClass + " " + op.opName();

        updatePairs(op.opName(), opClass);

        // TODO: to be implemented
        //for (OpProfilerListener listener : listeners) {
        //  listener.invoke(op);
        //}
    }
54628
def dispatch(self, event, *args):
        

        for callback in self.listeners.get(event, []):
            if len(args) > 0:
                callback(*args)
            else:
                callback()