Ends a previously opened flush suite. If there is no other active suite,
a flush is performed.

@throws NoFlushSuiteStartedException if no flush suite has been started
502509
public function endFlushSuite()
    {
        if ($this->flushSuiteLevel === 0) {
            throw new NoFlushSuiteStartedException('No flush suite has been started');
        }

        --$this->flushSuiteLevel;
        $this->flush();
        if ($this->activateLog && $this->showFlushLevel) $this->logFlushLevel();
    }
925083
@Override
  protected void flushAndSync(boolean durable) throws IOException {
    if (fp == null) {
      throw new IOException("Trying to use aborted output stream");
    }
    preallocate(); // preallocate file if necessary
    if (doubleBuf.isFlushed()) {
      return;
    }
    doubleBuf.flushTo(fp);
    if (durable) {
      fc.force(false); // metadata updates not needed
    }
    fc.position(fc.position() - 1); // skip back the end-of-file marker
  }
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;
            }
        }        
    }
1238723
public void addFlush() {
        // There is no need to process all entries if there was already a flush before and no new messages
        // where added in the meantime.
        //
        // See https://github.com/netty/netty/issues/2577
        Entry entry = unflushedEntry;
        if (entry != null) {
            if (flushedEntry == null) {
                // there is no flushedEntry yet, so start with the entry
                flushedEntry = entry;
            }
            do {
                flushed ++;
                if (!entry.promise.setUncancellable()) {
                    // Was cancelled so make sure we free up memory and notify about the freed bytes
                    int pending = entry.cancel();
                    decrementPendingOutboundBytes(pending, false, true);
                }
                entry = entry.next;
            } while (entry != null);

            // All flushed so reset unflushedEntry
            unflushedEntry = null;
        }
    }
905132
public void clearFlushStack()
    {
        if (stackQueue != null && !stackQueue.isEmpty())
        {
            stackQueue.clear();
        }
        if (joinTableDataCollection != null && !joinTableDataCollection.isEmpty())
        {
            joinTableDataCollection.clear();
        }

        if (eventLogQueue != null)
        {
            eventLogQueue.clear();
        }
    }
411846
void doFlush()
    {
        enableFlush = true;
        flush();
        execute();
        enableFlush = false;
        flushManager.commit();
        flushManager.clearFlushStack();
    }
1023931
public function flush()
    {
        parent::flush();

        $this->middleware = [];
        $this->currentRoute = [];
        $this->loadedProviders = [];
        $this->routeMiddleware = [];
        $this->reboundCallbacks = [];
        $this->resolvingCallbacks = [];
        $this->availableBindings = [];
        $this->ranServiceBinders = [];
        $this->loadedConfigurations = [];
        $this->afterResolvingCallbacks = [];

        $this->router = null;
        $this->dispatcher = null;
        static::$instance = null;
    }
699493
def _flush(self):
        
        self.classes_names = None
        self.__cache_methods = None
        self.__cached_methods_idx = None
        self.__cache_fields = None

        # cache methods and fields as well, otherwise the decompiler is quite slow
        self.__cache_all_methods = None
        self.__cache_all_fields = None
1287274
public void flush() {
        if (annotationsBlocked()) return;
        if (isFlushing()) return;

        startFlushing();
        try {
            while (q.nonEmpty()) {
                q.next().run();
            }
            while (typesQ.nonEmpty()) {
                typesQ.next().run();
            }
            while (afterTypesQ.nonEmpty()) {
                afterTypesQ.next().run();
            }
            while (validateQ.nonEmpty()) {
                validateQ.next().run();
            }
        } finally {
            doneFlushing();
        }
    }
119816
public function flush()
    {
        $removeService = GeneralUtility::makeInstance(RemoveService::class);
        $removeService->softRemoveDir(GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER))->removeDirs();
        $this->freeze = false;
    }
708260
public void flush() {
        List<BatchEntry> temp;

        bufferLock.lock();
        try {
            // Reset the last flush timestamp, even if the batch is empty or flush fails
            lastFlush = System.currentTimeMillis();

            // No-op if batch is empty
            if (batch == batchSize) {
                logger.trace("[{}] Batch empty, not flushing", name);
                return;
            }

            // Declare the batch empty, regardless of flush success/failure
            batch = batchSize;

            // If something goes wrong we still have a copy to recover.
            temp = buffer;
            buffer = new LinkedList<>();

        } finally {
            bufferLock.unlock();
        }

        long start = System.currentTimeMillis();
        try {
            flushTransactionLock.lock();
            start = System.currentTimeMillis();

            processBatch(temp);

            logger.trace("[{}] Batch flushed. Took {} ms, {} rows.", name, (System.currentTimeMillis() - start), temp.size());
        } catch (final Exception e) {
            if (this.maxFlushRetries > 0) {
                logger.warn(dev, "[{}] Error occurred while flushing. Retrying.", name, e);
            }

            boolean success = false;
            int retryCount;

            for (retryCount = 0; retryCount < this.maxFlushRetries && !success; retryCount++) {
                try {
                    Thread.sleep(this.flushRetryDelay);

                    // If the connection was established, we might need a rollback.
                    if (de.checkConnection() && de.isTransactionActive()) {
                        de.rollback();
                    }

                    processBatch(temp);

                    success = true;
                } catch (final InterruptedException ex) {
                    logger.debug("Interrupted while trying to flush batch. Stopping retries.");
                    Thread.currentThread().interrupt();
                    break;
                } catch (final Exception ex) {
                    logger.warn(dev, "[{}] Error occurred while flushing (retry attempt {}).", name, retryCount + 1, ex);
                }
            }

            if (!success) {
                try {
                    if (de.isTransactionActive()) {
                        de.rollback();
                    }
                } catch (final Exception ee) {
                    ee.addSuppressed(e);
                    logger.trace("[{}] Batch failed to check the flush transaction state", name, ee);
                }

                onFlushFailure(temp.toArray(new BatchEntry[temp.size()]));
                logger.error(dev, "[{}] Error occurred while flushing. Aborting batch flush.", name, e);
            } else {
                logger.trace("[{}] Batch flushed. Took {} ms, {} retries, {} rows.", name,
                        (System.currentTimeMillis() - start), retryCount, temp.size());
            }
        } finally {
            try {
                if (de.isTransactionActive()) {
                    de.rollback();
                }
            } catch (final Exception e) {
                logger.trace("[{}] Batch failed to check the flush transaction state", name, e);
            } finally {
                flushTransactionLock.unlock();
            }
        }
    }
1293911
@Override
    public void finish() {
        // An assertion failure here means this CE
        // did not come from a CE pool and this
        // should never be the case;
        //assert cacheEntryPool != null;
        // if cacheEntryPool is null, the cacheEntry is not allocated from the pool
        if (cacheEntryPool != null) {
            synchronized (cacheEntryPool.cache) {
                decRefCount();
                if (refCount.get() <= 0) {
                    if (refCount.get() < 0)
                        refCount.set(0);
                    if (removeWhenUnpinned && refCount.get() == 0) {
                        returnToPool();
                    }
                }
            }
        } else {
            synchronized (this.id) {
                decRefCount();
                if (refCount.get() <= 0) {
                    reset();
                }
            }
        }
    }
874922
final void flushComplete() throws IOException {
        synchronized (lock) {
            try {
                bufferFull = false;
                int remaining = header.getRemainingInBuffer();
                boolean finalFrame = finalFrameQueued;
                boolean channelClosed = finalFrame && remaining == 0 && !header.isAnotherFrameRequired();
                if (remaining > 0) {
                    body.getBuffer().limit(body.getBuffer().limit() + remaining);
                    if (finalFrame) {
                        //we clear the final frame flag, as it could not actually be written out
                        //note that we don't attempt to requeue, as whatever stopped it from being written will likely still
                        //be an issue
                        this.finalFrameQueued = false;
                    }
                } else if (header.isAnotherFrameRequired()) {
                    this.finalFrameQueued = false;
                    if (body != null) {
                        body.close();
                        body = null;
                        state &= ~STATE_PRE_WRITE_CALLED;
                    }
                } else if (body != null) {
                    body.close();
                    body = null;
                    state &= ~STATE_PRE_WRITE_CALLED;
                }
                if (channelClosed) {
                    fullyFlushed = true;
                    if (body != null) {
                        body.close();
                        body = null;
                        state &= ~STATE_PRE_WRITE_CALLED;
                    }
                } else if (body != null) {
                    // We still have a body, but since we just flushed, we transfer it to the write buffer.
                    // This works as long as you call write() again

                    //TODO: this code may not work if the channel has frame level compression and flow control
                    //we don't have an implementation that needs this yet so it is ok for now

                    body.getBuffer().compact();
                    writeBuffer = body;
                    body = null;
                    state &= ~STATE_PRE_WRITE_CALLED;
                }

                if (header.getByteBuffer() != null) {
                    header.getByteBuffer().close();
                }
                header = null;

                readyForFlush = false;
                if (isWriteResumed() && !channelClosed) {
                    wakeupWrites();
                } else if (isWriteResumed()) {
                    //we need to execute the write listener one last time
                    //we need to dispatch it back to the IO thread, so we don't invoke it recursivly
                    ChannelListeners.invokeChannelListener(getIoThread(), (S) this, getWriteListener());
                }

                final ChannelListener<? super S> closeListener = this.closeSetter.get();
                if (channelClosed && closeListener != null) {
                    ChannelListeners.invokeChannelListener(getIoThread(), (S) AbstractFramedStreamSinkChannel.this, closeListener);
                }
                handleFlushComplete(channelClosed);
            } finally {
                wakeupWaiters();
            }
        }
    }
1161139
public static function flush() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "flush"), func_get_args());
	}
1272921
public function flush()
    {
        if ($this->fileSystem->isDirectory($this->directory))
        {
            $this->fileSystem->deleteDirectory($this->directory, true);
        }
    }
590176
private void flush(Collection<Record> recordsToBeFlushed, boolean backup) {
        for (Record record : recordsToBeFlushed) {
            mapDataStore.flush(record.getKey(), record.getValue(), backup);
        }
    }
1081805
protected function flush()
    {
        echo "\nFlushing directories... ";
        foreach ($this->flushPaths as $dir) {
            $path = $this->basePath . '/' . $dir;
            if (file_exists($path)) {
                $this->flushDirectory($path);
            }
            $this->ensureDirectory($path);
        }
        echo "done\n";
    }