Search in sources :

Example 1 with TwoLongValue

use of net.openhft.chronicle.core.values.TwoLongValue in project Chronicle-Queue by OpenHFT.

the class SingleChronicleQueueStore method loadWritePosition.

private LongValue loadWritePosition(@NotNull WireIn wire) {
    final ValueIn read = wire.read(MetaDataField.writePosition);
    final int code;
    final long start = wire.bytes().readPosition();
    try {
        wire.consumePadding();
        code = wire.bytes().uncheckedReadUnsignedByte();
    } finally {
        wire.bytes().readPosition(start);
    }
    if (code == BinaryWireCode.I64_ARRAY) {
        TwoLongValue result = wire.newTwoLongReference();
        // when the write position is and array it also encodes the sequence number in the write position as the second long value
        read.int128(result);
        return result;
    }
    final LongValue result = wire.newLongReference();
    read.int64(result);
    return result;
}
Also used : ValueIn(net.openhft.chronicle.wire.ValueIn) TwoLongValue(net.openhft.chronicle.core.values.TwoLongValue) LongValue(net.openhft.chronicle.core.values.LongValue) TwoLongValue(net.openhft.chronicle.core.values.TwoLongValue)

Aggregations

LongValue (net.openhft.chronicle.core.values.LongValue)1 TwoLongValue (net.openhft.chronicle.core.values.TwoLongValue)1 ValueIn (net.openhft.chronicle.wire.ValueIn)1