int (double fractionOfCleanPagesToAim) { int totalPagesToReclaim = pagesForReclaimDirty.size() + pagesForReclaimNonDirty.size(); int dirtyPagesTargetCount = (int)((1 - fractionOfCleanPagesToAim) * totalPagesToReclaim); int pagesToFlush = pagesForReclaimDirty.size() - dirtyPagesTargetCount; int actuallyFlushed = 0; for (int i = 0; i < pagesToFlush; i++) { PageImpl page = pagesForReclaimDirty.get(i); if (page.isTombstone()) { continue; } try { //TODO RC: .tryFlush() prevents housekeeper thread from stalling on the page lock -- but the // thread could still get stuck on actual flush IO. Ideally all IO should be offloaded // from the housekeeper thread to an IO pool. if (page.tryFlush()) { actuallyFlushed++; //not strictly true, since actual flush could be short-circuit, but... }//MAYBE RC: else -> remove page from candidates for reclamation, since it is IN USE now? } catch (IOException e) { LOG.warn("Can't flush page " + page, e); } } return actuallyFlushed; }