Performs the listener {@code action} method with the specified event
queue and event.

@param eventQueue the specified event
@param event      the specified event
@see #action(org.b3log.latke.event.Event)
769719
final void performAction(final AbstractEventQueue eventQueue, final Event<?> event) {
        final Event<T> eventObject = (Event<T>) event;

        try {
            action(eventObject);
        } catch (final Exception e) {
            LOGGER.log(Level.WARN, "Event perform failed", e);
        } finally { // remove event from event queue
            if (eventQueue instanceof SynchronizedEventQueue) {
                final SynchronizedEventQueue synchronizedEventQueue = (SynchronizedEventQueue) eventQueue;

                synchronizedEventQueue.removeEvent(eventObject);
            }
        }
    }
703879
private void fireOnPurgeQueue(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onPurgeQueue(e);
        }
    }
894759
@Override
    public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
    {

        // logger.error(event);
        boolean wanted = false;
        /**
         * Dump any events we arn't interested in ASAP to minimise the
         * processing overhead of these events.
         */
        // Only enqueue the events that are of interest to one of our listeners.
        synchronized (this.globalEvents)
        {
            Class< ? extends ManagerEvent> shadowEvent = CoherentEventFactory.getShadowEvent(event);
            if (this.globalEvents.contains(shadowEvent))
            {
                wanted = true;
            }
        }

        if (wanted)
        {

            // We don't support all events.
            this._eventQueue.add(new EventLifeMonitor<>(event));
            final int queueSize = this._eventQueue.size();
            if (this._queueMaxSize < queueSize)
            {
                this._queueMaxSize = queueSize;
            }
            this._queueSum += queueSize;
            this._queueCount++;

            if (CoherentManagerEventQueue.logger.isDebugEnabled())
            {
                if (this._eventQueue.size() > ((this._queueMaxSize + (this._queueSum / this._queueCount)) / 2))
                {
                    CoherentManagerEventQueue.logger.debug("queue gtr max avg: size=" + queueSize + " max:" //$NON-NLS-1$ //$NON-NLS-2$
                            + this._queueMaxSize + " avg:" + (this._queueSum / this._queueCount)); //$NON-NLS-1$
                }
            }
        }
    }
150688
@MainThread
    private void handleEventResult(Event event, EventResult result) {
        if (!activeEvents.contains(event)) {
            Utils.logE(event.getKey(), "Cannot send result of finished event");
            return;
        }

        scheduleResultCallbacks(event, result);
        executeTasks(false);
    }
187471
@Override
    public void executeEventCallback(Runnable callback) {
        if (!nodeEngine.isRunning()) {
            return;
        }
        try {
            eventExecutor.execute(callback);
        } catch (RejectedExecutionException e) {
            rejectedCount.inc();

            if (eventExecutor.isLive()) {
                logFailure("EventQueue overloaded! Failed to execute event callback: %s", callback);
            }
        }
    }
450837
@Override
	protected void append(ILoggingEvent event) {
		// Render the event according to layout
		String formattedEvent = layout.doLayout(event);
		// Prepare to be queued
		this.le_async.addLineToQueue(formattedEvent);
	}
17293
public void addEvent(Event event) {
        if(event == null)
            throw new IllegalStateException("event must be non-null");

        if(logger.isTraceEnabled())
            logger.trace("Adding event " + event);

        eventQueue.add(event);
    }
701895
public void processEvent(EventObject event) {
    if (event instanceof RequestEvent) {
      processRequestEvent((RequestEvent) event);
    } else {
      LOG.error("invalid event type received: " + event.getClass().getName() + ": "
          + event.toString());
    }
  }
1010809
public void addEventListener(EventListener listener)
    	throws IllegalArgumentException
    {
       
        if (_eventListeners==null)
            _eventListeners=new ArrayList();
        
        if (listener instanceof ComponentListener ||
            listener instanceof LifeCycleListener )
        {
            if(log.isDebugEnabled())log.debug("addEventListener: "+listener);      
            _eventListeners=LazyList.add(_eventListeners,listener);
        }
      
    }
269807
public void addEventToReportingQueue(GobblinTrackingEvent event) {
    if (this.reportingQueue.size() > QUEUE_CAPACITY * 2 / 3) {
      immediatelyScheduleReport();
    }
    try {
      if (!this.reportingQueue.offer(sanitizeEvent(event), 10, TimeUnit.SECONDS)) {
        log.error("Enqueuing of event {} at reporter with class {} timed out. Sending of events is probably stuck.",
            event, this.getClass().getCanonicalName());
      }
    } catch (InterruptedException ie) {
      log.warn("Enqueuing of event {} at reporter with class {} was interrupted.", event,
          this.getClass().getCanonicalName(), ie);
    }
  }
1016095
public void trigger(Object event){

        Set<Class> eventTypes = getAllInheritedClasses(event.getClass());

        for (Class eventType : eventTypes) {
            if(observers.containsKey(eventType)){
                for (EventObserver eventObserver : observers.get(eventType)) {
                    executionQueue.get().add(new EventExecution(event, eventObserver));
                }
            }
        }

        triggerQueue();
    }
470859
private void fireOnDeleteQueue(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onDeleteQueue(e);
        }
    }
1186315
protected void fireEvent(HotKey hotKey) {
        HotKeyEvent event = new HotKeyEvent(hotKey);
        if (useSwingEventQueue) {
            SwingUtilities.invokeLater(event);
        } else {
            if (eventQueue == null) {
                eventQueue = Executors.newSingleThreadExecutor();
            }
            eventQueue.execute(event);
        }
    }
1224623
public void queue(final AsyncEvent<K> _event) {
    final K key = _event.getKey();
    synchronized (getLockObject(key)) {
      Queue<AsyncEvent<K>> q = keyQueue.get(key);
      if (q != null) {
        q.add(_event);
        return;
      }
      q = new LinkedList<AsyncEvent<K>>();
      keyQueue.put(key, q);
    }
    Runnable r = new Runnable() {
      @Override
      public void run() {
        runMoreOrStop(_event);
      }
    };
    executor.execute(r);
  }
929713
public <T> void handleEvent(final T event) throws EventException {
		final Class<?> type = event.getClass();
		if (!this.cachedListeners.containsKey(event.getClass())) {
			this.cachedListeners.put(type, new LinkedList<ListenerInstancePair<?>>());
			for (final ListenerInstancePair<?> listener : this.listeners) {
				final Type observableType = GenericsUtil.getEntityGenericType(listener.listener.getClass(), 0, Listener.class);
				final Class<?> observable = GenericsUtil.guessClazz(observableType);
				if (observable.isAssignableFrom(type)) {
					this.cachedListeners.get(type).add(listener);
				}
			}
		}
		@SuppressWarnings("unchecked")
		final List<ListenerInstancePair<T>> resolvedListeners = List.class.cast(this.cachedListeners.get(event.getClass()));
		for (final ListenerInstancePair<T> listener : resolvedListeners) {
			listener.handleEvent(event, null);
		}
	}
371578
function enqueueEvent( self, eventItem ) {
   if( self.eventQueue_.length === 0 ) {
      self.nextTick_( () => {
         const queuedEvents = self.eventQueue_;

         self.eventQueue_ = [];

         processWaitingPublishPromises( self, processQueue( self, queuedEvents ) );
      } );
   }
   self.eventQueue_.push( eventItem );
}
126342
public void addAction(ModelAction action, ModelActionListener listener)
    {
        
        synchronized(actionQueue) {
            this.actionQueue.add(new ModelActionEntry(action, listener));
        }
        
        wakeUp();
        
    }