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

com.kolibrifx.plovercrest.server.ReadObserver 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;

import java.nio.ByteBuffer;

public abstract class ReadObserver {

    private long lastValidTimestamp = -1;

    public abstract T observe(long timestamp, ByteBuffer bytes);

    public void observeEnd(final long lastValidTimestamp) {
        this.lastValidTimestamp = lastValidTimestamp;
    }

    /**
     * Override to detect that a table has been frozen. This will only happen after observeEnd().
     */
    public void observeFrozen() {
    }

    /**
     * If the end of the stream has been observed, returns the last valid timestamp. Otherwise, -1
     * is returned.
     */
    public long getLastValidTimestamp() {
        return lastValidTimestamp;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy