use of net.openhft.chronicle.core.values.LongValue in project Chronicle-Queue by OpenHFT.
the class SingleChronicleQueue method appendDocument.
@Override
public long appendDocument(@NotNull Bytes buffer) {
long length = checkRemainingForAppend(buffer);
LongValue writeByte = header.writeByte();
for (; ; ) {
long lastByte = writeByte.getVolatileValue();
if (bytes.compareAndSwapInt(lastByte, 0, NOT_COMPLETE | (int) length)) {
long lastByte2 = lastByte + 4 + buffer.remaining();
bytes.write(lastByte + 4, buffer);
long lastIndex = header.lastIndex().addAtomicValue(1);
writeByte.setOrderedValue(lastByte2);
bytes.writeOrderedInt(lastByte, (int) length);
return lastIndex;
}
int length2 = length30(bytes.readVolatileInt());
bytes.skip(length2);
try {
Jvm.checkInterrupted();
} catch (InterruptedException e) {
throw new InterruptedRuntimeException(e);
}
}
}
Aggregations