Calls flushTermination(), flushUpdate(), flushInsert() and shutdown() and waits for all pending tasks
to finish.

To ensure proper error handling, this method must be called.
329800
public void waitUntilFinished()
    {
        flushTermination();
        flushUpdate();
        flushInsert();
        shutdown();
        for (int i = 0; i < numberOfQueues; i++)
        {
            while (!executors[i].isTerminated())
            {
                try
                {
                    executors[i].awaitTermination(10000000, TimeUnit.SECONDS);
                }
                catch (InterruptedException e)
                {
                    // ignore
                }
            }
        }
        if (useBulkInsert)
        {
            bulkInsert();
        }
        logFinalResults();
        if (this.error != null)
        {
            if (error instanceof RuntimeException)
            {
                throw (RuntimeException) error;
            } else
            {
                throw new RuntimeException("One or more parallel tasks failed", this.error);
            }
        }
    }
939367
@Override
  protected void flushAndSync(boolean durable) throws IOException {
    if (outputStream == null) {
      throw new IOException("Trying to use aborted output stream!");
    }
    if (doubleBuf.isFlushed()) {
      return;
    }
    // Under the covers, this invokes a method that does not return until
    // we have successfully persisted the buffer to a quorum of bookies.
    doubleBuf.flushTo(outputStream);
  }
264790
public synchronized void flush()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
            trace.entry(this,
                        cclass,
                        "flush");
            trace.exit(this,
                       cclass,
                       "flush");
        }
    }
800477
def _end_flusher_loop(self):
        
        if not self.is_connected or self.is_connecting or self.io.closed():
            if self._flush_queue is not None and self._flush_queue.empty():
                self._flush_pending(check_connected=False)
            yield tornado.gen.moment
1206789
protected void awaitTasksTermination()
   {
      delegated.shutdown();
      try
      {
         delegated.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
      }
      catch (InterruptedException e)
      {
         LOG.warn("Termination has been interrupted");
      }
   }
201405
public void flushUpdate()
    {
        for (int i = 0; i < numberOfQueues; i++)
        {
            if (!dbUpdateLists[i].isEmpty())
            {
                this.submitTaskToQueue(this.createUpdateTask(dbUpdateLists[i], fileUpdateLists[i]), i, processedUpdates);
                this.dbUpdateLists[i] = new ArrayList(batchSize);
                this.fileUpdateLists[i] = new ArrayList(batchSize);
                this.updatesQueued++;
            }
        }
    }
1218661
public void flush() {
        BulkResponse bulk = tryFlush();
        if (!bulk.getDocumentErrors().isEmpty()) {
            int maxErrors = 5;
            String header = String.format("Could not write all entries for bulk operation [%s/%s]. Error " +
                    "sample (first [%s] error messages):\n", bulk.getDocumentErrors().size(), bulk.getTotalDocs(), maxErrors);
            StringBuilder message = new StringBuilder(header);
            int i = 0;
            for (BulkResponse.BulkError errors : bulk.getDocumentErrors()) {
                if (i >=maxErrors ) {
                    break;
                }
                message.append("\t");
                appendError(message, errors.getError());
                message.append("\n");
                message.append("\t")
                	.append(errors.getDocument().toString())
                	.append("\n");
                i++;
            }
            message.append("Bailing out...");
            throw new EsHadoopException(message.toString());
        }
    }
477360
public function flush()
    {
        $result = $this->bucket->manager()->flush();
        if (isset($result['_'])) {
            throw new FlushException($result);
        }
    }
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();
      }
    }
  }
236729
@Override
    public void flush() throws IOException {
        PipedInputStream stream = target;
        if (stream == null) {
            return;
        }

        synchronized (stream) {
            stream.notifyAll();
        }
    }
841213
public ISynchronizationPoint<OutputErrorType> flush() {
		SynchronizationPoint<OutputErrorType> sp = new SynchronizationPoint<>();
		Runnable callback = new Runnable() {
			@Override
			public void run() {
				AsyncWork<OutputResultType, OutputErrorType> last = null;
				synchronized (waiting) {
					if (error != null) sp.error(error);
					else if (cancelled != null) sp.cancel(cancelled);
					else if (isReady) sp.unblock();
					else last = lastWrite;
				}
				if (last != null)
					last.listenInline(this);
			}
		};
		callback.run();
		return sp;
	}
1002601
public void awaitTermination() {
        try {
            latch.await();
        } catch (InterruptedException e) {
            String message = "awaitTermination() method was interrupted!";
            throw new UnsupportedOperationException(message, e);
        }
    }
440553
public void flush()
        throws IOException
    {
        try
        {
            if (!_commited)
            {
                _commited=true;
                if (_commitObserver!=null)
                    _commitObserver.outputNotify(this,OutputObserver.__COMMITING,null);
            }
            
            wrapBuffer();
            
            // Add headers
            if (_httpMessageWriter.size()>0)
            {
                prewrite(_httpMessageWriter.getBuf(),0,_httpMessageWriter.size());
                _httpMessageWriter.resetWriter();
            }
            
            if (size()>0)
                writeTo(_out);
        }
        catch (IOException e)
        {
            throw new EOFException(e);
        }
        finally
        {
            reset(_preReserve);
        }
    }
59644
public void flushTxLog() {
        synchronized (flushCompleteSignal) {
            BufferName enqueueBuffer;
            synchronized (txLogToVEBuf.getPot()) {
                // Enqueue the backup task
                enqueueBuffer = txLogToVEBuf.getEnqueueBuffer(); 
                FlushNowJob flushJob = new FlushNowJob();
                txLogToVEBuf.addAndExecuteWork(flushJob);
            }
            
            try {
                do {
                    log.debug("Waiting for flush to complete in buffer {}", enqueueBuffer);
                    flushCompleteSignal.wait();
                    log.debug("Flush complete in buffer {}", lastFlushedBuffer);
                } while (lastFlushedBuffer != enqueueBuffer);
            } catch (InterruptedException e) {
                BitsyException toThrow = new BitsyException(BitsyErrorCodes.FLUSH_INTERRUPTED, "Exception while waiting for a transaction-log flush to be performed", e);

                log.error("Error while flushing the transaction log", toThrow);

                throw toThrow;
            }
        }        
    }
900932
public function flush()
    {
        if (!is_null($this->putBatch)) {
            $this->putBatch->flush();
            $this->putBatch = null;
        }
        if (!is_null($this->deleteBatch)) {
            $this->deleteBatch->flush();
            $this->deleteBatch = null;
        }
    }
1094187
public function flush()
    {
        parent::flush();

        $this->buildStack = [];
        $this->loadedProviders = [];
        $this->bootedCallbacks = [];
        $this->bootingCallbacks = [];
        $this->deferredServices = [];
        $this->reboundCallbacks = [];
        $this->serviceProviders = [];
        $this->resolvingCallbacks = [];
        $this->afterResolvingCallbacks = [];
        $this->globalResolvingCallbacks = [];
    }
291880
public void waitTillAllUpdatesExecuted() throws InterruptedException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "waitTillAllUpdatesExecuted");
    synchronized (this)
    {
      while (enqueuedUnits.size() > 0 || executing)
      {
        try
        {
          this.wait();
        }
        catch (InterruptedException e)
        {
          // No FFDC code needed
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "waitTillAllUpdatesExecuted", e);
          throw e;
        }
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "waitTillAllUpdatesExecuted");
  }