FlushResult (final /*InOut*/ IntRef contentionQuota) { //TODO RC: check if there _any_ index to flush -- otherwise no need to flush IndexingStamp either IndexingStamp.flushCaches(); final IndexConfiguration indexes = getState(); FlushResult overallResult = FlushResult.NOTHING_TO_FLUSH_NOW; for (ID<?, ?> indexId : indexes.getIndexIDs()) { final IndexFlushingState indexFlushingState = flushingStates.computeIfAbsent(indexId, IndexFlushingState::new); final FlushResult indexFlushResult = indexFlushingState.tryFlushIfNeeded( indexes, contentionQuota, flushingPeriodMs ); overallResult = overallResult.and(indexFlushResult); if (LOG.isTraceEnabled()) { LOG.trace("\t" + indexFlushingState + " " + indexFlushResult); } final int contentionQuotaRemains = contentionQuota.get(); if (contentionQuotaRemains <= 0) { contentionQuota.set(contentionQuotaRemains); return FlushResult.HAS_MORE_TO_FLUSH; } } return overallResult; }