All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kolibrifx.plovercrest.server.internal.streams.EntryIndexRangeObserver Maven / Gradle / Ivy

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy