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

com.kolibrifx.plovercrest.server.internal.protocol.SubscriberLastValidTimestampEvent 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.protocol;

import java.nio.ByteBuffer;
import com.kolibrifx.plovercrest.client.internal.remote.RemoteResponse;

public class SubscriberLastValidTimestampEvent extends StandaloneSubscriberEvent {
    private final long entryIndex;
    private final long lastValidTimestamp;

    public SubscriberLastValidTimestampEvent(final int subscriptionId, final long entryIndex, final long lastValidTimestamp) {
        super(subscriptionId);
        this.entryIndex = entryIndex;
        this.lastValidTimestamp = lastValidTimestamp;
    }

    @Override
    ByteBuffer serialize() {
        final ByteBuffer tmpBuffer = ByteBuffer.allocate(24);
        tmpBuffer.putInt(RemoteResponse.SUBSCRIBE_LAST_VALID_TIMESTAMP.getTag());
        tmpBuffer.putInt(subscriptionId);
        tmpBuffer.putLong(entryIndex);
        tmpBuffer.putLong(lastValidTimestamp);
        return tmpBuffer;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy