@NotNull @Override public WireStore writePosition(long position) { assert singleThreadedAccess(); assert writePosition.getVolatileValue() + mappedFile.chunkSize() > position; assert Wires.isReadyData(mappedBytes.readVolatileInt(position)); writePosition.setMaxValue(position); return this; }
public int getWritingThreadId() { final WireStore wireStore = queue.storeForCycle(queue.cycle(), queue.epoch(), false); if (wireStore != null) { final long position = wireStore.writePosition(); final int header = wireStore.bytes().readVolatileInt(position); if (Wires.isReady(header)) { final long nextHeaderPosition = position + Wires.lengthOf(header) + Wires.SPB_HEADER_SIZE; final int unfinishedHeader = wireStore.bytes(). readVolatileInt(nextHeaderPosition); if (Wires.isNotComplete(unfinishedHeader) && unfinishedHeader != 0) { return Wires.extractTidFromHeader(unfinishedHeader); } } } return NO_CURRENT_WRITER; } }
mappedBytes.readLimit(mappedBytes.realCapacity()); while (mappedWire.readDataHeader()) { int header = mappedBytes.readVolatileInt(); if (Wires.isNotComplete(header)) break;
@NotNull @Override public WireStore writePosition(long position) { assert singleThreadedAccess(); assert writePosition.getVolatileValue() + mappedFile.chunkSize() > position; assert Wires.isReadyData(mappedBytes.readVolatileInt(position)); writePosition.setMaxValue(position); return this; }
public int getWritingThreadId() { final WireStore wireStore = queue.storeForCycle(queue.cycle(), queue.epoch(), false); if (wireStore != null) { final long position = wireStore.writePosition(); final int header = wireStore.bytes().readVolatileInt(position); if (Wires.isReady(header)) { final long nextHeaderPosition = position + Wires.lengthOf(header) + Wires.SPB_HEADER_SIZE; final int unfinishedHeader = wireStore.bytes(). readVolatileInt(nextHeaderPosition); if (Wires.isNotComplete(unfinishedHeader) && unfinishedHeader != 0) { return Wires.extractTidFromHeader(unfinishedHeader); } } } return NO_CURRENT_WRITER; } }
mappedBytes.readLimit(mappedBytes.realCapacity()); while (mappedWire.readDataHeader()) { int header = mappedBytes.readVolatileInt(); if (Wires.isNotComplete(header)) break;