com.kolibrifx.plovercrest.server.internal.streams.EntryIndexRangeObserver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
The newest version!
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server.internal.streams;
import com.kolibrifx.plovercrest.server.streams.StreamObserver;
public class EntryIndexRangeObserver extends RangeStreamObserver {
private final long endIndex;
public EntryIndexRangeObserver(final StreamObserver wrappedObserver, final long endIndex) {
super(wrappedObserver);
this.endIndex = endIndex;
}
@Override
public void onObserveImpl(final long timestamp, final long index, final T element) {
if (index >= endIndex) {
throwEndOfRange();
}
callWrappedObserver(timestamp, index, element);
}
}