{@inheritdoc}

@throws RuntimeException If event queue overflowed
349263
public function getEvents()
    {
        $inotifyEvents = $this->readEvents();

        $inotifyEvents = is_array($inotifyEvents) ? $inotifyEvents : array();

        $last = end($inotifyEvents);
        if (IN_Q_OVERFLOW === $last['mask']) {
            throw new RuntimeException('Event queue overflowed. Either read events more frequently or increase the limit for queues. The limit can be changed in /proc/sys/fs/inotify/max_queued_events');
        }

        foreach ($inotifyEvents as $event) {
            foreach ($this->bag->get($event['wd']) as $watched) {
                $watched->setEvent($event['mask'], $event['name']);
            }
        }

        $events = array();

        foreach ($this->checkers as $meta) {
            $tracked = $meta['tracked'];
            $watched = $meta['checker'];
            foreach ($watched->getChangeset() as $change) {
                $events[] = new FilesystemEvent($tracked, $change['resource'], $change['event']);
            }
        }

        return $events;
    }
245154
protected function exceptionIfFetchedAlready()
    {
        if ($this->fetched) {
            throw new RuntimeException(
                Message::get(Message::DB_FETCHED_ALREADY),
                Message::DB_FETCHED_ALREADY
            );
        }
    }
295907
private static void throwRuntimeException(String msg, InvocationTargetException e) {
    Throwable cause = e.getCause();
    if (cause != null) {
      throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
    } else {
      throw new RuntimeException(msg + ": " + e.getMessage(), e);
    }
  }
1369050
public function postBatch()
    {
        $fp = fsockopen($this->hostname, $this->port, $errno, $errstr, 30);

        if (FALSE === $fp) {
            throw new \RuntimeException($errstr, $errno);
        }

        for ($i = 0, $c = count($this->buffer); $i < $c; $i++) {

            $message = $this->buffer[$i];

            $request = "POST /inputs/" . $this->input->getKey() . " HTTP/1.1\r\n";
            $request .= "Host: " . ClientInterface::LOGGLY_HOST . "\r\n";
            $request .= "User-Agent: " . ClientInterface::USER_AGENT . "\r\n";
            $request .= "Content-Type: " . $this->getContentType() . "\r\n";
            $request .= "Content-Length: " . strlen($message) . "\r\n";

            // Add Connection: Close header on the last request.
            $request .= $i === $c - 1 ? "Connection: Close\r\n\r\n" : "\r\n";

            $request .= $message;
            $request .= $i === $c - 1 ? "" : "\r\n";

            fwrite($fp, $request);
        }

        fclose($fp);

        return TRUE;
    }
1136151
function () {
        
            var i, 
                queueItem,
                key,
                value,
                property;
        
            this.queueInProgress = true;
            for (i = 0;i < this.eventQueue.length; i++) {
                queueItem = this.eventQueue[i];
                if (queueItem) {
        
                    key = queueItem[0];
                    value = queueItem[1];
                    property = this.config[key];

                    property.value = value;

                    // Clear out queue entry, to avoid it being 
                    // re-added to the queue by any queueProperty/supercedes
                    // calls which are invoked during fireEvent
                    this.eventQueue[i] = null;

                    this.fireEvent(key,value);
                }
            }
            
            this.queueInProgress = false;
            this.eventQueue = [];
        }
559010
public function subscribe($queue)
    {
        if ($this->currentEnvelope) {
            throw new \RuntimeException('Don\'t be greedy and process the message you already have!');
        }

        $this->queue = $this->manager->getQueue((string) $queue);
    }
512436
@Override
    public void registerLimit(final long limit) {

        if (queues.size() > 0) {
            if (unlimited.get(currentQueue())
                         .get())
                limits.get(currentQueue())
                      .set(0);

            limits.get(currentQueue())
                  .addAndGet(limit);
            unlimited.get(currentQueue())
                     .set(false);

            queues.stream()
                  .forEach(this::closeQueueIfFinishedStateless);

        }
    }
1229597
private void tryRunNext() {
        while (runningSemaphore.tryAcquire()) {
            ExecutionTask execution = queue.poll();
            if (execution != null) {
                // Note: we've removed the execution from the queue so we're committed to running it
                // if we fail to do so for any reason, we need to call the exception handler to fail the execution
                try {
                    execution.submit();
                } catch (Throwable e) {
                    // Any exception here is unexpected
                    runningSemaphore.release();
                    execution.exceptionHandler.handle(e);
                }
            } else {
                runningSemaphore.release();
                break;
            }
        }
    }
120170
public static void throwRuntimeException(Throwable t)
    {
        // Unchecked? Can re-throw as is
        throwIfUnchecked(t);
        // Otherwise, let's just change its type:
        throw new RuntimeException("[was "+t.getClass()+"] "+t.getMessage(), t);
    }
1145912
function() {
    // Set `eventQueue` to null before processing it so that we can tell if more
    // events get enqueued while processing.
    var processingEventQueue = eventQueue;
    eventQueue = null;
    forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
    ("production" !== "development" ? invariant(
      !eventQueue,
      'processEventQueue(): Additional events were enqueued while processing ' +
      'an event queue. Support for this has not yet been implemented.'
    ) : invariant(!eventQueue));
  }
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);
            }
        }
    }
1303644
public static void runInEventDispatcherThread(Runnable runnable, Boolean wait) {

        Assert.notNull(runnable, "runnable");
        Assert.notNull(wait, "wait");

        if (EventQueue.isDispatchThread()) {
            runnable.run();
        } else if (wait) {
            try {
                EventQueue.invokeAndWait(runnable);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e);
            }
        } else {
            EventQueue.invokeLater(runnable);
        }
    }
1065922
Lockable<V> getEvent(EventId eventId) {
		return eventsBufferCache.computeIfAbsent(eventId, id -> {
			try {
				return eventsBuffer.get(id);
			} catch (Exception ex) {
				throw new WrappingRuntimeException(ex);
			}
		});
	}
160505
public void runMoreOrStop(AsyncEvent<K> _event) {
    for (;;) {
      try {
        _event.execute();
      } catch (Throwable t) {
        cache.getLog().warn("Async event exception", t);
      }
      final K key = _event.getKey();
      synchronized (getLockObject(key)) {
        Queue<AsyncEvent<K>> q = keyQueue.get(key);
        if (q.isEmpty()) {
          keyQueue.remove(key);
          return;
        }
        _event = q.remove();
      }
    }
  }
183041
public function trigger(EventInterface $event, \Closure $callback = null)
    {
        if ($listeners = $this->getListeners($event->getName())) {
            foreach ($listeners as $listener) {
                if ($result = call_user_func($listener, $event)) {
                    if ($result instanceof EventInterface) {
                        // Was the queue halted early ?
                        if ($result->isQueueHaltedEarly()) {
                            return $this;
                        }

                        if ($callback !== null) {
                            call_user_func($callback, $result);
                        }

                        // Was the queue halted ?
                        if ($result->isQueueHalted()) {
                            return $this;
                        }
                    } else {
                        throw new \RuntimeException(
                            'Value returned from an Event Callback must be of type Proem\Signal\EventInterface'
                        );
                    }
                }
            }
        }

        return $this;
    }
376447
@Override
    public void dispatchNextGuiEvent() throws InterruptedException {
        EventQueue queue = awtEventQueue;
        if (queue == null) {
            queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
            awtEventQueue = queue;
        }
        AWTEvent event = queue.getNextEvent();
        if (event instanceof ActiveEvent) {
            ((ActiveEvent)event).dispatch();
        } else {
            Object source = event.getSource();
            if (source instanceof Component) {
                Component comp = (Component)source;
                comp.dispatchEvent(event);
            } else if (source instanceof MenuComponent) {
                ((MenuComponent)source).dispatchEvent(event);
            }
        }
    }
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();
    }