@@ -0,0 +1,3263 @@
+package net.openhft.chronicle.queue.impl.single;%0A%0Aimport net.openhft.chronicle.queue.DirectoryUtils;%0Aimport net.openhft.chronicle.queue.ExcerptAppender;%0Aimport net.openhft.chronicle.queue.ExcerptTailer;%0Aimport net.openhft.chronicle.queue.RollCycles;%0Aimport net.openhft.chronicle.wire.DocumentContext;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0A%0Aimport java.io.File;%0Aimport java.io.ObjectInput;%0Aimport java.io.ObjectOutput;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0A@Ignore%0Apublic final class DuplicateMessageReadTest %7B%0A%0A    @Test%0A    public void shouldNotReceiveDuplicateMessages() throws Exception %7B%0A        final File location = DirectoryUtils.tempDir(DuplicateMessageReadTest.class.getSimpleName());%0A%0A        final SingleChronicleQueue chronicleQueue = SingleChronicleQueueBuilder%0A                .binary(location)%0A                .rollCycle(RollCycles.HOURLY)%0A                .build();%0A%0A        // this warmup with a different appender creates the problem%0A        final ExcerptAppender preTouchAppender = chronicleQueue.acquireAppender();%0A        preTouchAppender.pretouch();%0A%0A%0A        System.out.printf(%22First appender: %25s%25n%22, preTouchAppender);%0A%0A        final List%3CData%3E expected = new ArrayList%3C%3E();%0A        for (int i = 0; i %3C 10; i++) %7B%0A            expected.add(new Data(i));%0A        %7D%0A%0A        final ExcerptTailer tailer = chronicleQueue.createTailer();%0A        tailer.toEnd(); // move to end of chronicle before writing%0A%0A        // use different appender to write data%0A        final ExcerptAppender appender = chronicleQueue.acquireAppender();%0A        System.out.printf(%22Writing appender: %25s%25n%22, appender);%0A        for (final Data data : expected) %7B%0A            write(appender, data);%0A        %7D%0A%0A        final List%3CData%3E actual = new ArrayList%3C%3E();%0A        for (Data data = read(tailer); data != null; data = read(tailer)) %7B%0A            actual.add(data);%0A        %7D%0A%0A        assertThat(actual, is(expected));%0A    %7D%0A%0A    private static void write(final ExcerptAppender appender, final Data data) throws Exception %7B%0A        try (final DocumentContext dc = appender.writingDocument()) %7B%0A            final ObjectOutput out = dc.wire().objectOutput();%0A            out.writeInt(data.id);%0A        %7D%0A    %7D%0A%0A    private static Data read(final ExcerptTailer tailer) throws Exception %7B%0A        try (final DocumentContext dc = tailer.readingDocument()) %7B%0A            if (!dc.isPresent()) %7B%0A                return null;%0A            %7D%0A            final ObjectInput in = dc.wire().objectInput();%0A            return new Data(in.readInt());%0A        %7D%0A    %7D%0A%0A    private static final class Data %7B%0A        private final int id;%0A%0A        private Data(final int id) %7B%0A            this.id = id;%0A        %7D%0A%0A        @Override%0A        public boolean equals(Object o) %7B%0A            if (this == o)%0A                return true;%0A            if (o == null %7C%7C getClass() != o.getClass())%0A                return false;%0A%0A            Data data = (Data) o;%0A%0A            return id == data.id;%0A        %7D%0A%0A        @Override%0A        public int hashCode() %7B%0A            return id;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return %22%22 + id;%0A        %7D%0A    %7D%0A%7D

add test to demonstrate behaviour reported in #378