/** * @param term the current term * @return a snapshot metadata based on nothing but the term */ public static StateSnapshotMetadata createInitial(int term) { return new StateSnapshotMetadata( INITIAL_LAST_PROCESSED_EVENT_POSITION, INITIAL_LAST_WRITTEN_EVENT_POSITION, term, false); }
/** * @param term the current term * @return a snapshot metadata based on nothing but the term */ public static StateSnapshotMetadata createInitial(int term) { return new StateSnapshotMetadata( INITIAL_LAST_PROCESSED_EVENT_POSITION, INITIAL_LAST_WRITTEN_EVENT_POSITION, term, false); }
public StateSnapshotMetadata getSnapshotMetadata(final File folder) { if (folder == null) { throw new NullPointerException(); } if (folder.exists() && !folder.isDirectory()) { throw new IllegalArgumentException("given file is not a directory"); } final String name = folder.getName(); final String[] parts = name.split(SEPARATOR, 3); return new StateSnapshotMetadata( Long.parseLong(parts[0]), Long.parseLong(parts[1]), Integer.parseInt(parts[2]), folder.exists()); }
public StateSnapshotMetadata getSnapshotMetadata(final File folder) { if (folder == null) { throw new NullPointerException(); } if (folder.exists() && !folder.isDirectory()) { throw new IllegalArgumentException("given file is not a directory"); } final String name = folder.getName(); final String[] parts = name.split(SEPARATOR, 3); return new StateSnapshotMetadata( Long.parseLong(parts[0]), Long.parseLong(parts[1]), Integer.parseInt(parts[2]), folder.exists()); }
private void doCreateSnapshot() { if (currentEvent != null) { final long lastWrittenPosition = lastWrittenEventPosition > lastSuccessfulProcessedEventPosition ? lastWrittenEventPosition : lastSuccessfulProcessedEventPosition; final StateSnapshotMetadata metadata = new StateSnapshotMetadata( lastSuccessfulProcessedEventPosition, lastWrittenPosition, streamProcessorContext.getLogStream().getTerm(), false); writeSnapshot(metadata); } // reset to cpu bound actor.setSchedulingHints(SchedulingHints.cpuBound(ActorPriority.REGULAR)); }
private void doCreateSnapshot() { if (currentEvent != null) { final long lastWrittenPosition = lastWrittenEventPosition > lastSuccessfulProcessedEventPosition ? lastWrittenEventPosition : lastSuccessfulProcessedEventPosition; final StateSnapshotMetadata metadata = new StateSnapshotMetadata( lastSuccessfulProcessedEventPosition, lastWrittenPosition, streamProcessorContext.getLogStream().getTerm(), false); writeSnapshot(metadata); } // reset to cpu bound actor.setSchedulingHints(SchedulingHints.cpuBound(ActorPriority.REGULAR)); }