Flush the callback queue.

Invokes callbacks which were on the queue when tick() was called and newly added ones.
4004
public function tick()
    {
        while (!$this->queue->isEmpty() && $this->loop->isRunning())
        {
            $this->callback = $this->queue->dequeue();
            $callback = $this->callback; // without this proxy PHPStorm marks line as fatal error.
            $callback($this->loop);
        }
    }
477319
@Override
    public void flush()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "em.flush();\n" + toString());

        getEMInvocationInfo(true).flush();
    }
394943
function(evt, forceFlush){
    this.eventQueue.push(evt);
    if (this.eventQueue.length >= this.maxQueueSize || forceFlush){
      this.flush();
    }
  }
408449
public void flush()
  {
    if (!enabled)
    {
      return;
    }
    if (!queue.isEmpty())
    {
      // start a new thread to upload without blocking the current thread
      Runnable runUpload = new TelemetryUploader(this, exportQueueToString());
      uploader.execute(runUpload);
    }
  }
207456
private void flushQueues()
  {
    // Terminate data loading thread.
    LOGGER.debug("Flush Queues");
    try
    {
      _queueData.put(new byte[0]);
      _thread.join(10000);

      if (_thread.isAlive())
      {
        _thread.interrupt();
      }
    }
    catch (Exception ex)
    {
      String msg = "Failed to join StreamLoader queue: " + ex.getMessage();
      LOGGER.error(msg, ex);
      throw new DataError(msg, Utils.getCause(ex));
    }
    // Put last stage on queue
    terminate();

    // wait for the processing to finish
    _put.join();
    _process.join();

    if (_aborted.get())
    {
      // Loader was aborted due to an exception. 
      // It was rolled back at that time.

      //LOGGER.log(Level.WARNING,
      //            "Loader had been previously aborted by error", _abortCause);
      throw _abortCause;
    }
  }
658285
def flushall(self, asynchronous=False):
        
        args = []
        if asynchronous:
            args.append(Token.get_token('ASYNC'))
        return self.execute_command('FLUSHALL', *args)
1122327
function flush() {
    if (queue.length) {
      //
      // We might want to indicate that these are already queued, so we don't
      // fetch data again.
      //
      queue.splice(0).sort(function sort(a, b) {
        return a.id - b.id;
      }).forEach(onmessage);
    }
  }
121887
public void flush() {
    try {
      ArrayList<Batch> batches = this.incomplete.all();
      int numOutstandingRecords = 0;
      for (Batch batch: batches) {
        numOutstandingRecords += batch.getRecords().size();
      }
      LOG.debug ("Flush called on {} batches with {} records total", batches.size(), numOutstandingRecords);
      for (Batch batch: batches) {
        batch.await();
      }
    } catch (Exception e) {
      LOG.error ("Error happened while flushing batches");
    }
  }
487550
def on_timer(self):
        
        try:
            self.flush()
        except Exception as e:
            log.exception('Error while flushing: %s', e)
        self._set_timer()
1167890
def flush(self):
        
        self.acquire()
        try:
            if self.stream and hasattr(self.stream, "flush"):
                self.stream.flush()
        finally:
            self.release()
1017779
public void flush() {
        logger.info(String.format("(%s) Flush, buffer size: %d", detectorImpl.getName(), queue.size()));
        while(queue.size()>0)
            detectorImpl.fireEvent(queue.poll());
    }
1267485
def flush
      mutex.synchronize do
        if thread && thread.alive?
          queue.push(marker)
          marker.wait(mutex)
        end
      end
    end
314018
private void flush() {
    try {
      QueuedCommand cmd;
      int i = 0;
      boolean flushedOnce = false;
      while ((cmd = queue.poll()) != null) {
        cmd.run(channel);
        if (++i == DEQUE_CHUNK_SIZE) {
          i = 0;
          // Flush each chunk so we are releasing buffers periodically. In theory this loop
          // might never end as new events are continuously added to the queue, if we never
          // flushed in that case we would be guaranteed to OOM.
          channel.flush();
          flushedOnce = true;
        }
      }
      // Must flush at least once, even if there were no writes.
      if (i != 0 || !flushedOnce) {
        channel.flush();
      }
    } finally {
      // Mark the write as done, if the queue is non-empty after marking trigger a new write.
      scheduled.set(false);
      if (!queue.isEmpty()) {
        scheduleFlush();
      }
    }
  }
399339
def flush(self):
        
        self.acquire()
        try:
            if self.outStream and hasattr(self.outStream, "flush"):
                self.outStream.flush()
            if self.errStream and hasattr(self.errStream, "flush"):
                self.errStream.flush()
        finally:
            self.release()
59195
def flush(self, *args, **kwgs):
        
        if settings['LOG_RESPONSE'] and not self._status_code == 500:
            log_response(self)

        super(BaseHandler, self).flush(*args, **kwgs)
131886
def _flush(self):
        
        # Send a None down the queue to indicate a flush
        try:
            self.queue.put(None, block=False)
        except Queue.Full:
            self._throttle_error('Queue full, check handlers for delays')
427500
def _run_queued_callbacks(self):
        '''  '''
        for callback in self._queued_callbacks:
            try:
                callback()
            except Exception as ex:
                logger.error("Exception: %s" % str(ex))