@Override
    public void flushAll() {
        LOGGER.logDurationIfDebugEnabled(() -> {
            try {
                final Set<Long> openWritersIdSet = new HashSet<>(cache.keySet());
                if (!openWritersIdSet.isEmpty()) {
                    // Flush all writers.
                    final CountDownLatch countDownLatch = new CountDownLatch(openWritersIdSet.size());
                    openWritersIdSet.forEach(indexShardId -> {
                        try {
                            flush(indexShardId, executor)
                                    .thenRun(countDownLatch::countDown);
                        } catch (final RuntimeException e) {
                            LOGGER.error(e::getMessage, e);
                            countDownLatch.countDown();
                        }
                    });
                    countDownLatch.await();
                }
            } catch (final InterruptedException e) {
                LOGGER.trace(e::getMessage, e);
                // Continue to interrupt this thread.
                Thread.currentThread().interrupt();
            }
        }, "flushAll()");
    }
This is called by the lifecycle service and will call flush on all open writers.
stroom-index/stroom-index-impl/src/main/java/stroom/index/impl/IndexShardWriterCacheImpl.java