All Listeners for the current thread
496189
def __listeners_for_thread(self):
        """"""

        thread = get_thread_ident()
        with self.lock:
            return [l for tid, l in self.listeners.items() if tid == thread]
573726
function() {
        if (finished === true) {
            return;
        }
        finished = true;
        req.removeAllListeners();
        if (response !== null) {
            response.removeAllListeners();
        }
        callback.apply(null, arguments);
    }
621418
def update_record(self, now, rec):
        """"""
        for listener in self.listeners:
            listener.update_record(self, now, rec)
        self.notify_all()
344921
public synchronized void addListener(String threadPrefix,
			EventListener listener) {
		if (threadPrefix.trim().equals("")) {
			globalListeners.addElement(listener);
		} else {
			keyedListeners.put(threadPrefix.trim(), listener);
		}
	}
1333500
private void registerListeners() {
    protocol.registerAppendHandler(this::append);
    protocol.registerBackupHandler(this::backup);
    protocol.registerConsumeHandler(this::consume);
    protocol.registerResetConsumer(this::reset, threadContext);
  }
1279516
public final synchronized L[] getListeners() {
        if (this.map == null) {
            return newArray(0);
        }
        List<L> list = new ArrayList<>();

        L[] listeners = this.map.get(null);
        if (listeners != null) {
            for (L listener : listeners) {
                list.add(listener);
            }
        }
        for (Entry<String, L[]> entry : this.map.entrySet()) {
            String name = entry.getKey();
            if (name != null) {
                for (L listener : entry.getValue()) {
                    list.add(newProxy(name, listener));
                }
            }
        }
        return list.toArray(newArray(list.size()));
    }
140816
function onListening() {
    const addr = server.address();
    const bind = (typeof addr === 'string')
                ? 'pipe ' + addr
                : 'port ' + addr.port;
    debugServer('Listening on ' + bind);
  }
1050097
def listen(self, listener):
        ''''''
        for message in listener.listen():
            try:
                data = json.loads(message['data'])
                if data['event'] in ('canceled', 'lock_lost', 'put'):
                    self.kill(data['jid'])
            except:
                logger.exception('Pubsub error')
1117014
def run(self):
        
        listener_thr = _spawn(self.receiver.run)
        callback_thr = _spawn(self.callbacks.run)
        sender_thr = _spawn(self.sender.run)
        logger_thr = _spawn(self.logger.run)

        self.connect()
        try:
            yield
        finally:
            self.stop()

            # Wait for the listener to finish.
            listener_thr.join()
            self.callbacks.put('shutdown')

            # Tell the other threads to finish, and wait for them.
            for obj in [self.callbacks, self.sender, self.logger]:
                obj.stop()
            for thr in [callback_thr, sender_thr, logger_thr]:
                thr.join()
184950
def get_listeners(self, event_type: str) -> List[Callable]:
        """"""
        if event_type not in self.events:
            raise ValueError(f'No event {event_type} in system.')
        return self.events.get_listeners(event_type)
918831
def validate_listeners(self):
        """"""

        if self.exception:
            # pylint: disable=raising-bad-type
            raise self.exception

        listeners = self.__listeners_for_thread
        if not sum(len(l) for l in listeners):
            raise ValueError("No active listeners")
1019292
def listen(self):
        """"""

        self.validate_listeners()
        with ARBITRATOR.condition:
            while self.connected:
                ARBITRATOR.condition.wait()
                if not self.run_queues():
                    break
416488
def listen(self, callback=None, timeout=(5, 300)):
        """"""
        if self._running:
            return False
        # if self.devices() is False:
        #    return False
        self._queue = Queue()
        self._running = True
        self._timeout = timeout
        self._callback_listen = callback
        threading.Thread(target=self._thread_listen, args=()).start()
        threading.Thread(target=self._thread_worker, args=()).start()
        return True
1112881
public SynchronizedCollection<EventListener> getListeners() {
		final Object mutex = mutex();
		synchronized (mutex) {
			return Collections3.synchronizedCollection(this.listeners.values(), mutex);
		}
	}
599337
function listener (event, done) {
  return function onevent (arg1) {
    var args = new Array(arguments.length)
    var ee = this
    var err = event === 'error'
      ? arg1
      : null

    // copy args to prevent arguments escaping scope
    for (var i = 0; i < args.length; i++) {
      args[i] = arguments[i]
    }

    done(err, ee, event, args)
  }
}
230375
private static void forAll(final /* java.util.function.Consumer<ItemListener> */Function<ItemListener,Void> consumer) {
        for (ItemListener l : all()) {
            try {
                consumer.apply(l);
            } catch (RuntimeException x) {
                LOGGER.log(Level.WARNING, "failed to send event to listener of " + l.getClass(), x);
            }
        }
    }
492125
public void dispatch (T object) {
		final Object[] items = listeners.begin();
		for (int i = 0, n = listeners.size; i < n; i++) {
			Listener<T> listener = (Listener<T>)items[i];
			listener.receive(this, object);
		}
		listeners.end();
	}