Trigger a flush of the queue.
        Note: this method will only return once the queue is empty. This means it can block indefinitely if more events
        are produced in other threads than can be consumed.
482093
def flush(self):
        
        self.queue(None, None, flush=True)
        if not self._flushed.wait(timeout=self._max_flush_time):
            raise ValueError("flush timed out")
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')
512624
private void flushEventBuffer() {
        Holder<T> holder = buffer.get();
        logger.accept(holder.getBuffer().get());
        holder.clear();
    }
1048044
public void flush() throws IOException {
    try {
      flushIfPossible(true);
      checkState(pendingRequests.isEmpty(), "pendingRequests should be empty after flush");
      checkState(responseFutures.isEmpty(), "responseFutures should be empty after flush");
    } finally {
      requestsExecutor.shutdown();
      try {
        if (!requestsExecutor.awaitTermination(1, TimeUnit.SECONDS)) {
          logger.atWarning().log("Forcibly shutting down batch helper thread pool.");
          requestsExecutor.shutdownNow();
        }
      } catch (InterruptedException e) {
        logger.atFine().withCause(e).log(
            "Failed to await termination: forcibly shutting down batch helper thread pool.");
        requestsExecutor.shutdownNow();
      }
    }
  }
265502
function flush() {
    if (queue) {
      result.push(queue)

      if (handleText) {
        handleText.call(textContext, queue, {start: prev, end: now()})
      }

      queue = ''
    }
  }
23338
def flush(self):
        
        if self._requests_middleware:
            self._requests_middleware.flush()

        if self._trace_log_handler:
            self._trace_log_handler.flush()

        if self._exception_telemetry_client:
            self._exception_telemetry_client.flush()
86480
protected function flushIfNeeded() {
        if (!$this->_enabled) {
            return;
        }

        $now = $this->_util->nowMicros();
        $delta = $now - $this->_lastFlushMicros;

        // Set a bound on maximum flush frequency
        if ($delta < $this->_minFlushPeriodMicros) {
            return;
        }

        // Set a bound of minimum flush frequency
        if ($delta > $this->_maxFlushPeriodMicros) {
            $this->flush();
            return;
        }

        // Look for a trigger that a flush is warranted
        if (count($this->_logRecords) >= $this->_options["max_log_records"]) {
            $this->flush();
            return;
        }
        if (count($this->_spanRecords) >= $this->_options["max_span_records"]) {
            $this->flush();
            return;
        }
    }
205723
public void flush() throws IOException
    {   
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "flush");
        boolean crlfWrite = false;
        // check for nonblocking
        if(this._listener!= null){
            synchronized(this){

                WebContainerRequestState reqState = WebContainerRequestState.getInstance(false);
                if (reqState!=null && reqState.getAttribute("com.ibm.ws.webcontainer.CRLFWriteinPorgress")!=null){                                      
                    crlfWrite = true;
                }
                if(this.isWriteReadyWork(false) || crlfWrite ){
                    super.flush();
                }
                else{
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                        Tr.debug(tc, "cannot flush, not write ready");
                    
                    return;
                }
            }
        }
        else{
            super.flush();
        }
    }
973169
def flush(self):
        
        if self.debug:
            sys.stderr.write("%s: FLUSH INPUT (%i bytes waiting)\n" %(
                    self.__class__.__name__,
                    self.ser.inWaiting()
                    ))
        self.ser.flushInput()
427350
public void flush(final long targetCounter) throws IOException, JournalClosedException {
    // Return if flushed.
    if (targetCounter <= mFlushCounter.get()) {
      return;
    }

    // Submit the ticket for flush thread to process.
    FlushTicket ticket = new FlushTicket(targetCounter);
    try (LockResource lr = new LockResource(mTicketLock)) {
      mTicketList.add(ticket);
    }

    try {
      // Give a permit for flush thread to run.
      mFlushSemaphore.release();

      // Wait on the ticket until completed.
      ticket.waitCompleted();
    } catch (InterruptedException ie) {
      // Interpret interruption as cancellation.
      throw new AlluxioStatusException(Status.CANCELLED.withCause(ie));
    } catch (Throwable e) {
      // Filter, journal specific exception codes.
      if (e instanceof IOException) {
        throw (IOException) e;
      }
      if (e instanceof JournalClosedException) {
        throw (JournalClosedException) e;
      }
      // Not expected. throw internal error.
      throw new AlluxioStatusException(Status.INTERNAL.withCause(e));
    } finally {
      /**
       * Client can only try to reacquire the permit it has given
       * because the permit may or may not have been used by the flush thread.
       */
      mFlushSemaphore.tryAcquire();
    }
  }
1146694
private void doFlush() {
    // Runs the loop until ::stop() is called.
    while (!mStopFlushing) {

      /**
       * Stand still unless;
       * - queue has items
       * - permit is given by:
       *   - clients
       *   -::stop()
       */
      while (mQueue.isEmpty() && !mStopFlushing) {
        try {
          // Wait for permit up to batch timeout.
          // PS: We don't wait for permit indefinitely in order to process
          // queued entries proactively.
          if (mFlushSemaphore.tryAcquire(mFlushBatchTimeNs, TimeUnit.NANOSECONDS)) {
            break;
          }
        } catch (InterruptedException ie) {
          break;
        }
      }

      try {
        long startTime = System.nanoTime();

        // Write pending entries to journal.
        while (!mQueue.isEmpty()) {
          // Get, but do not remove, the head entry.
          JournalEntry entry = mQueue.peek();
          if (entry == null) {
            // No more entries in the queue. Break write session.
            break;
          }
          mJournalWriter.write(entry);
          // Remove the head entry, after the entry was successfully written.
          mQueue.poll();
          mWriteCounter++;

          if (((System.nanoTime() - startTime) >= mFlushBatchTimeNs) && !mStopFlushing) {
            // This thread has been writing to the journal for enough time. Break out of the
            // infinite while-loop.
            break;
          }
        }

        // Either written new entries or previous flush had been failed.
        if (mFlushCounter.get() < mWriteCounter) {
          mJournalWriter.flush();
          mFlushCounter.set(mWriteCounter);
        }

        // Notify tickets that have been served to wake up.
        try (LockResource lr = new LockResource(mTicketLock)) {
          ListIterator<FlushTicket> ticketIterator = mTicketList.listIterator();
          while (ticketIterator.hasNext()) {
            FlushTicket ticket = ticketIterator.next();
            if (ticket.getTargetCounter() <= mFlushCounter.get()) {
              ticket.setCompleted();
              ticketIterator.remove();
            }
          }
        }
      } catch (IOException | JournalClosedException exc) {
        // Release only tickets that have been flushed. Fail the rest.
        try (LockResource lr = new LockResource(mTicketLock)) {
          ListIterator<FlushTicket> ticketIterator = mTicketList.listIterator();
          while (ticketIterator.hasNext()) {
            FlushTicket ticket = ticketIterator.next();
            ticketIterator.remove();
            if (ticket.getTargetCounter() <= mFlushCounter.get()) {
              ticket.setCompleted();
            } else {
              ticket.setError(exc);
            }
          }
        }
      }
    }
  }
1347855
def flush(self):
        
        if self._writable:
            with self._seek_lock:
                self._flush_raw_or_buffered()

                # Clear the buffer
                self._write_buffer = bytearray(self._buffer_size)
                self._buffer_seek = 0
1199345
public synchronized boolean flush() {
		if (!validState) {
			throw new InvalidStateException();
		}
		try {
			flushBuffer();
			return true;
		} catch (Exception e) {
			log.error("Exception in flush()", e);
		}
		return false;
	}
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;
    }
  }
184594
@Override
    public void flush() {
        if (isStarted) {
            flushBuffer();
            //To avoid memory leaks...
            Arrays.fill(buffer, null);
            isStarted = false;
        }
    }
1280163
def flush(self, queue_name):
        
        for _ in iter_queue(self.queues[queue_name]):
            self.queues[queue_name].task_done()
950452
def _flush(self):
        
        if not self.enabled:
            return
        try:
            try:
                self.lock.acquire()
                self.flush()
            except Exception:
                self.log.error(traceback.format_exc())
        finally:
            if self.lock.locked():
                self.lock.release()