use of net.openhft.chronicle.bytes.NativeBytesStore in project Chronicle-Queue by OpenHFT.
the class BytesRingBufferTest method testFlowAroundSingleThreadedWriteDifferentSizeBuffers.
@Test
public void testFlowAroundSingleThreadedWriteDifferentSizeBuffers() {
try (NativeBytesStore<Void> nativeStore = NativeBytesStore.nativeStoreWithFixedCapacity(150)) {
System.out.println(nativeStore.realCapacity());
System.out.println(nativeStore.capacity());
System.out.println(nativeStore.limit());
assert !nativeStore.isElastic();
Bytes<Void> bytes = nativeStore.bytes();
System.out.println(bytes);
for (int j = 23 + 34; j < 100; j++) {
final BytesRingBuffer bytesRingBuffer = new BytesRingBuffer(nativeStore.bytes());
for (int i = 0; i < 50; i++) {
bytesRingBuffer.offer(data());
String actual = bytesRingBuffer.take(maxSize -> input.clear()).readUTFΔ();
assertEquals(EXPECTED, actual);
}
}
}
}
use of net.openhft.chronicle.bytes.NativeBytesStore in project Chronicle-Queue by OpenHFT.
the class DirectChronicleQueueStringTest method readSome.
private void readSome(DirectChronicleQueue chronicle) {
NativeBytesStore allocate = NativeBytesStore.nativeStoreWithFixedCapacity(EXPECTED_BYTES.length);
final Bytes toRead = allocate.bytes();
AtomicLong offset = new AtomicLong(chronicle.firstBytes());
for (int i = 0; i < RUNS; i++) {
toRead.clear();
chronicle.readDocument(offset, toRead);
}
}
Aggregations