Package com.higherfrequencytrading.chronicle

Examples of com.higherfrequencytrading.chronicle.Excerpt.nextIndex()


        while (!fsr.isClosed()) {
            fd.readMessages(listener);
        }
        excerpt.index(-1);
        int count = 0;
        while (excerpt.nextIndex()) {
            int length = (int) excerpt.readStopBit();
            String fix = ChronicleTools.asString(excerpt, excerpt.position(), length);
            assertTrue(fix.startsWith("8=FIX"));
            assertTrue(fix.endsWith(".")); // ^A is replaced with .
            assertEquals(8, fix.length() - fix.lastIndexOf(".10="));
View Full Code Here


        long[] times = new long[repeats];
        int[] nbcs = new int[repeats];
        int count = 0;
        final Excerpt excerpt2 = chronicle.createExcerpt();
        while (excerpt2.nextIndex()) {
            final long timestamp = excerpt2.readLong();
            long time = System.nanoTime() - timestamp;
            times[count] = time;
            final int nbConsolidates = excerpt2.readInt();
            nbcs[count] = nbConsolidates;
View Full Code Here

        }
        excerpt.index(-1);

        StringBuilder date = new StringBuilder();
        long start = System.nanoTime();
        while (excerpt.nextIndex()) {
            long l = excerpt.parseLong();
            assert l == 8;
            String s = excerpt.parseEnum(String.class, StopCharTesters.CONTROL_STOP);
            assert s.equals("FIX.4.2");
            l = excerpt.parseLong();
View Full Code Here

            excerpt.index(n);
            String text = excerpt.readUTF();
            excerpt.finish();
            assertEquals("i: " + i, sb.toString(), text);
        }
        assertTrue(excerpt.nextIndex());
        String text = excerpt.readUTF();
        excerpt.finish();
        assertEquals(null, text);
    }
View Full Code Here

        @Override
        public void run() {
            Excerpt excerpt = chronicle.createExcerpt();
            do {
                excerpt.nextIndex();
            } while (!Thread.interrupted());
            chronicle.close();
        }
    }
View Full Code Here

            excerpt.finish();
        }

        int counter2 = 1;
        Excerpt excerpt2 = tsc.createExcerpt();
        while (excerpt2.nextIndex()) {
            for (int j = 0; j < 128; j += 8) {
                long actual = excerpt2.readLong();
                long expected = counter2++;
                if (expected != actual)
                    assertEquals(expected, actual);
View Full Code Here

            {
                IndexedChronicle ic = new IndexedChronicle(basePath);
                ic.useUnsafe(true);
                Excerpt excerpt = ic.createExcerpt();
                for (int i = 1; i <= records; i++) {
                    boolean found = excerpt.nextIndex();
                    if (!found)
                        assertTrue(found);
                    long l = excerpt.readLong();
                    double d = excerpt.readDouble();
                    if (l != i)
View Full Code Here

        ic.useUnsafe(true); // for benchmarks
        Excerpt excerpt = ic.createExcerpt();
        int blocks = 1000000;
        for (long j = 0; j < runs; j += blocks) {
            for (long i = j + 1; i <= j + blocks; i += batchSize) {
                while (!excerpt.nextIndex()) {
                    // busy wait
                }
                for (int k = 0; k < batchSize; k++) {
                    char ch = (char) excerpt.readUnsignedByte();
                    long l = excerpt.readLong();
View Full Code Here

    public void testHasNextIndexFail() throws IOException {
        final Chronicle chr = createChronicle("hasNextFail");

        final Excerpt readExcerpt = chr.createExcerpt();
        assertTrue("Read excerpt should have next index", readExcerpt.hasNextIndex());
        assertTrue("It should be possible to move to next index", readExcerpt.nextIndex());
    }

    @Test
    public void testHasNextIndexPass() throws IOException {
        final Chronicle chr = createChronicle("hasNextPass");
View Full Code Here

    @Test
    public void testHasNextIndexPass() throws IOException {
        final Chronicle chr = createChronicle("hasNextPass");

        final Excerpt readExcerpt = chr.createExcerpt();
        assertTrue("It should be possible to move to next index", readExcerpt.nextIndex());
        assertTrue("Read excerpt should have next index", readExcerpt.hasNextIndex());
    }

    @Test
    public void testHasNextIndexIteration() throws IOException {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.