Search in sources :

Example 1 with CheckpointReader

use of io.pravega.client.stream.impl.ReaderGroupState.CheckpointReader in project pravega by pravega.

the class ReaderGroupStateManager method checkpoint.

void checkpoint(String checkpointName, PositionInternal lastPosition) throws ReinitializationRequiredException {
    AtomicBoolean reinitRequired = new AtomicBoolean(false);
    sync.updateState(state -> {
        if (!state.isReaderOnline(readerId)) {
            reinitRequired.set(true);
            return null;
        }
        return Collections.singletonList(new CheckpointReader(checkpointName, readerId, lastPosition.getOwnedSegmentsWithOffsets()));
    });
    if (reinitRequired.get()) {
        throw new ReinitializationRequiredException();
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ReinitializationRequiredException(io.pravega.client.stream.ReinitializationRequiredException) CheckpointReader(io.pravega.client.stream.impl.ReaderGroupState.CheckpointReader)

Aggregations

ReinitializationRequiredException (io.pravega.client.stream.ReinitializationRequiredException)1 CheckpointReader (io.pravega.client.stream.impl.ReaderGroupState.CheckpointReader)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1