/** Abort all cursors opened on the provided log file. */ private void abortCursorsOpenOnLogFile(LogFile<K, V> logFile) { for (AbortableLogCursor<K, V> cursor : openCursors) { if (cursor.isAccessingLogFile(logFile)) { cursor.abort(); } } }
/** * Disable the cursors opened on the head log file log, by closing their underlying cursor. * Returns the state of each cursor just before the close operation. * * @return the pairs (cursor, cursor state) for each cursor pointing to head log file. * @throws ChangelogException If an error occurs. */ private List<Pair<AbortableLogCursor<K, V>, CursorState<K, V>>> disableOpenedCursorsOnHead() throws ChangelogException { final List<Pair<AbortableLogCursor<K, V>, CursorState<K, V>>> openCursorsStates = new ArrayList<>(); final LogFile<K, V> headLogFile = getHeadLogFile(); for (AbortableLogCursor<K, V> cursor : openCursors) { if (cursor.isAccessingLogFile(headLogFile)) { openCursorsStates.add(Pair.of(cursor, cursor.getState())); cursor.closeUnderlyingCursor(); } } return openCursorsStates; }