Flushes and closes the bulk processor to further writes.
975918
@Override
    public void close() {
        try {
            if (!hadWriteErrors) {
                flush();
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Dirty close; ignoring last existing write batch...");
                }
            }

            if (requiresRefreshAfterBulk && executedBulkWrite) {
                // refresh batch
                restClient.refresh(resource);

                if (LOG.isDebugEnabled()) {
                    LOG.debug(String.format("Refreshing index [%s]", resource));
                }
            }
        } finally {
            for (IBulkWriteErrorHandler handler : documentBulkErrorHandlers) {
                handler.close();
            }
        }
    }
67256
@Override
    public void flush() throws IOException {
        checkClosed();
        
        if (bs.isDirty()) {
            bs.write();
        }
        
        for (int i = 0; i < bs.getNrFats(); i++) {
            fat.writeCopy(bs.getFatOffset(i));
        }
        
        rootDir.flush();
        
        if (fsiSector != null) {
            fsiSector.setFreeClusterCount(fat.getFreeClusterCount());
            fsiSector.setLastAllocatedCluster(fat.getLastAllocatedCluster());
            fsiSector.write();
        }
    }
1185854
protected void flushData()
    {
        try
        {
            out.write(buffer, 0, validBufferBytes);
            lastFlushOffset += validBufferBytes;
        }
        catch (IOException e)
        {
            throw new FSWriteError(e, getPath());
        }
        if (runPostFlush != null)
            runPostFlush.run();
    }
806648
@GuardedBy("evictionLock")
  void drainWriteBuffer() {
    if (!buffersWrites()) {
      return;
    }

    for (int i = 0; i < WRITE_BUFFER_MAX; i++) {
      Runnable task = writeBuffer().poll();
      if (task == null) {
        return;
      }
      task.run();
    }
    lazySetDrainStatus(PROCESSING_TO_REQUIRED);
  }
1172875
void flushBuffer() throws IOException {
        synchronized (lock) {
            ensureOpen();
            if (nextChar == 0)
                return;
            out.write(cb, 0, nextChar);
            nextChar = 0;
        }
    }
393227
private void flushBuffer(final ByteBuffer buffer, final DataOutput stream) throws IOException {
        buffer.flip();
        stream.write(buffer.array(), buffer.arrayOffset(), buffer.remaining());

        buffer.clear();
    }
1207465
public void finish() throws IOException {
    if (finished) {
      return;
    }
    finished = true;
    sum.writeValue(barray, 0, false);
    out.write (barray, 0, sum.getChecksumSize());
    out.flush();
  }
419758
public void flush() throws IOException {
        if(closed) {
            throw new IllegalStateException("Can't flush packets on a closed stream!");
        }

        // Write in one go
        OggPage[] pages = buffer.toArray(new OggPage[buffer.size()]); 
        file.writePages(pages);

        // Get ready for next time!
        buffer.clear();
    }
98033
private void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException {
    buffer.flip();
    output.write(buffer);
    buffer.flip();
    buffer.limit(buffer.capacity());
  }
910393
public void flush() throws IOException {
        final ByteOutput output = this.output;
        final int pos = this.position;
        if (pos > 0) {
            output.write(CHUNK_START);
            writeInt(pos);
            final byte[] buffer = this.buffer;
            output.write(buffer, 0, pos);
        }
        this.position = 0;
    }
569217
protected function flush()
    {
        if (empty($this->sockets) && $this->fork() <= 0) {
            // Failed fork
            return;
        }

        $read = null;
        $write = $this->sockets;
        $except = null;

        if (stream_select($read, $write, $except, $this->timeout) > 0) {
            foreach ($write as $socket) {
                if ($this->queue->isEmpty()) {
                    break;
                }
                if ($this->write($socket, $this->queue->dequeue()) !== false) {
                    $this->remain++;
                }
            }
        }
    }
717108
def flush(self):
        """"""
        if self._num_outstanding_events == 0 or self._recordio_writer is None:
            return
        self._recordio_writer.flush()
        if self._logger is not None:
            self._logger.info('wrote %d %s to disk', self._num_outstanding_events,
                              'event' if self._num_outstanding_events == 1 else 'events')
        self._num_outstanding_events = 0
149223
def flush(self):
    """"""
    # Write data to in-memory buffer first.
    buf = cStringIO.StringIO()
    with records.RecordsWriter(buf) as w:
      for record in self._buffer:
        w.write(record)
      w._pad_block()
    str_buf = buf.getvalue()
    buf.close()

    if not self._exclusive and len(str_buf) > _FILE_POOL_MAX_SIZE:
      # Shouldn't really happen because of flush size.
      raise errors.Error(
          "Buffer too big. Can't write more than %s bytes in one request: "
          "risk of writes interleaving. Got: %s" %
          (_FILE_POOL_MAX_SIZE, len(str_buf)))

    # Write data to file.
    start_time = time.time()
    self._write(str_buf)
    if self._ctx:
      operation.counters.Increment(
          COUNTER_IO_WRITE_BYTES, len(str_buf))(self._ctx)
      operation.counters.Increment(
          COUNTER_IO_WRITE_MSEC,
          int((time.time() - start_time) * 1000))(self._ctx)

    # reset buffer
    self._buffer = []
    self._size = 0
    gc.collect()
119573
def flush(self):
        
        self._write_all(self._wbuffer.getvalue())
        self._wbuffer = StringIO()
        return
951197
def _flush(self):
        
        # Flush buffer to specified range
        buffer = self._get_buffer()
        start = self._buffer_size * (self._seek - 1)
        end = start + len(buffer)

        future = self._workers.submit(
            self._flush_range, buffer=buffer, start=start, end=end)
        self._write_futures.append(future)
        future.add_done_callback(partial(self._update_size, end))
887142
private void flushBuffer()
            throws IOException
    {
        if (buffer.position() > 0) {
            buffer.flip();
            writeCompressed(buffer);
            buffer.clear();
        }
    }
544627
public void flushTermination()
    {
        for (int i = 0; i < numberOfQueues; i++)
        {
            if (!terminateLists[i].isEmpty())
            {
                this.submitTaskToQueue(this.createTerminateTask(terminateLists[i]), i, processedTerminates);
                this.terminateLists[i] = new ArrayList(batchSize);
                this.terminatesQueued++;
            }
        }
    }