/** * Commits entries up to the given index to the log. * * @param index The index up to which to commit entries. * @return The log. * @throws IllegalStateException If the log is not open. */ public Log commit(long index) { assertIsOpen(); if (index > 0) { assertValidIndex(index); segments.commitIndex(index); if (storage.flushOnCommit()) { segments.currentSegment().flush(); } } return this; }
/** * Commits entries up to the given index to the log. * * @param index The index up to which to commit entries. * @return The log. * @throws IllegalStateException If the log is not open. */ public Log commit(long index) { assertIsOpen(); if (index > 0) { assertValidIndex(index); segments.commitIndex(index); if (storage.flushOnCommit()) { segments.currentSegment().flush(); } } return this; }