use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueStore in project Chronicle-Queue by OpenHFT.
the class RollEOFTest method loadStore.
private SingleChronicleQueueStore loadStore(Wire wire) {
try {
Method loadStoreMethod = SingleChronicleQueueBuilder.class.getDeclaredMethod("loadStore", Wire.class);
loadStoreMethod.setAccessible(true);
return (SingleChronicleQueueStore) loadStoreMethod.invoke(null, wire);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
use of net.openhft.chronicle.queue.impl.single.SingleChronicleQueueStore in project Chronicle-Queue by OpenHFT.
the class RollEOFTest method removeEOF.
private void removeEOF(Path path) throws IOException {
long blockSize = 64 << 10;
long chunkSize = OS.pageAlign(blockSize);
long overlapSize = OS.pageAlign(blockSize / 4);
final MappedBytes mappedBytes = MappedBytes.mappedBytes(path.toFile(), chunkSize, overlapSize, false);
mappedBytes.reserve();
try {
final Wire wire = WireType.BINARY_LIGHT.apply(mappedBytes);
final Bytes<?> bytes = wire.bytes();
bytes.readLimit(bytes.capacity());
bytes.readSkip(4);
// move past header
try (final SingleChronicleQueueStore qs = loadStore(wire)) {
assertNotNull(qs);
long l = qs.writePosition();
long len = Wires.lengthOf(bytes.readVolatileInt(l));
long eofOffset = l + len + 4L;
bytes.writePosition(eofOffset);
bytes.writeInt(0);
}
} finally {
mappedBytes.release();
}
}
Aggregations