use of io.pravega.client.stream.impl.ReaderGroupState.SegmentCompleted in project pravega by pravega.
the class ReaderGroupStateManager method handleEndOfSegment.
/**
* Handles a segment being completed by calling the controller to gather all successors to the completed segment.
*/
void handleEndOfSegment(Segment segmentCompleted) throws ReinitializationRequiredException {
val successors = getAndHandleExceptions(controller.getSuccessors(segmentCompleted), RuntimeException::new);
synchronized (this) {
latestDelegationToken = successors.getDelegationToken();
}
AtomicBoolean reinitRequired = new AtomicBoolean(false);
sync.updateState(state -> {
if (!state.isReaderOnline(readerId)) {
reinitRequired.set(true);
return null;
}
return Collections.singletonList(new SegmentCompleted(readerId, segmentCompleted, successors.getSegmentToPredecessor()));
});
if (reinitRequired.get()) {
throw new ReinitializationRequiredException();
}
acquireTimer.zero();
}
Aggregations