code: private void flushEventBuffer()
    {
      ArrayList<Event> eventBufferCopy;
  
      logger.debug("Flushing eventBuffer");
  
      // Copy event buffer because this may be long running
      synchronized (this)
      {
        eventBufferCopy = new ArrayList<>(eventBuffer);
        eventBuffer.clear();
      }
  
      for (Event event : eventBufferCopy)
      {
        event.flush();
      }
    }
docs: Function to copy the event buffer, clear it, and iterate of the copy,
  calling each event's flush() method one by one.
  <p>
  NOTE: This function is subject to a race condition; while the buffer copy
  is being iterated over, the next round of buffer entries could be flushed
  creating a flush order that is not "strictly consistent". While this could
  hypothetically also cause the system to run out of memory due to an
  unbounded number of eventBuffer copies, that scenario is unlikely.