Search in sources :

Example 1 with WireType

use of net.openhft.chronicle.wire.WireType in project Chronicle-Queue by OpenHFT.

the class Queue28Test method test.

/*
     * Tailer doesn't work if created before the appender
     *
     * See https://higherfrequencytrading.atlassian.net/browse/QUEUE-28
     */
@Test
public void test() {
    File dir = getTmpDir();
    try (final ChronicleQueue queue = SingleChronicleQueueBuilder.builder(dir, wireType).testBlockSize().build()) {
        final ExcerptTailer tailer = queue.createTailer();
        assertFalse(tailer.readDocument(r -> r.read(TestKey.test).int32()));
        final ExcerptAppender appender = queue.acquireAppender();
        appender.writeDocument(w -> w.write(TestKey.test).int32(1));
        Jvm.pause(100);
        assertTrue(tailer.readDocument(r -> r.read(TestKey.test).int32()));
    }
}
Also used : SingleChronicleQueueBuilder(net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder) Arrays(java.util.Arrays) net.openhft.chronicle.queue(net.openhft.chronicle.queue) Assert.assertFalse(org.junit.Assert.assertFalse) Collection(java.util.Collection) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) WireType(net.openhft.chronicle.wire.WireType) Jvm(net.openhft.chronicle.core.Jvm) Parameterized(org.junit.runners.Parameterized) File(java.io.File) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Jvm (net.openhft.chronicle.core.Jvm)1 net.openhft.chronicle.queue (net.openhft.chronicle.queue)1 SingleChronicleQueueBuilder (net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder)1 WireType (net.openhft.chronicle.wire.WireType)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 Parameterized (org.junit.runners.Parameterized)1