Package com.higherfrequencytrading.chronicle

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


        }

        for (; i2 < RUNS; i2++) {
            do {
                pause();
            } while (!excerpt2.index(i2));
            char type = excerpt2.readChar();
            if ('R' != type)
                assertEquals('R', type);
            int n = excerpt2.readInt();
            if (i2 != n)
View Full Code Here


            excerpt.writeChars("Hello");
            excerpt.writeLong(0L);
            excerpt.writeDouble(0.0);
            excerpt.finish();

            while (excerpt2.index(i2)) {
                char type = excerpt2.readChar();
                if ('R' != type)
                    assertEquals('R', type);
                int n = excerpt2.readInt();
                if (i2 != n)
View Full Code Here

        }

        for (; i2 < RUNS; i2++) {
            do {
                BusyWaiter.pause();
            } while (!excerpt2.index(i2));
            char type = excerpt2.readChar();
            if ('R' != type)
                assertEquals('R', type);
            int n = excerpt2.readInt();
            if (i2 != n)
View Full Code Here

                ByteBuffer bb = TcpUtil.createBuffer(1, chronicle.byteOrder()); // minimum size
                if (closed) {
                    return;
                }
                do {
                    while (!excerpt.index(index))
                        pause(delayNS);
                    int size = excerpt.capacity();
                    int remaining = size + TcpUtil.HEADER_SIZE;

                    bb.clear();
View Full Code Here

        this.address = address;
        this.outbound = outbound;
        this.inbound = inbound;

        Excerpt out = outbound.createExcerpt();
        out.index(out.size());
        outboundReader = new GatewayEntryReader(out, true) {
            final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1 << 20);

            @Override
            protected void onEntry(long writeTimeNS, long writeTimeMS, long readTimeMS, int length, char type, @NotNull Excerpt excerpt) {
View Full Code Here

                    inboundWriter.onException("Failed to write", e);
                }
            }
        };
        Excerpt in = inbound.createExcerpt();
        in.index(in.size());
        inboundWriter = new GatewayEntryWriter(in);

        waitingThread.add(this);
    }
View Full Code Here

            if (readOne) {
                // did something
                count = 0;
            } else if (count++ > 1000000) {
                // do something else like pause.
                long processed = excerpt.index() + 1;
                if (prevProcessed != processed) {
                    System.out.printf("Processed %,d requests%n", processed);
                    prevProcessed = processed;
                }
            }
View Full Code Here

                ByteBuffer bb = TcpUtil.createBuffer(1, chronicle.byteOrder()); // minimum size
                long sendInSync = 0;
                boolean first = true;
                OUTER:
                while (!closed) {
                    while (!excerpt.index(index)) {
//                        System.out.println("Waiting for " + index);
                        long now = System.currentTimeMillis();
                        if (sendInSync <= now && !first) {
                            bb.clear();
                            bb.putInt(IN_SYNC_LEN);
View Full Code Here

                        }
                    } else {
                        bb.limit(remaining);
                        excerpt.read(bb);
                        int count = 1;
                        while (excerpt.index(index + 1) && count++ < MAX_MESSAGE) {
                            if (excerpt.remaining() + 4 >= bb.capacity() - bb.position())
                                break;
                            // if there is free space, copy another one.
                            int size2 = excerpt.capacity();
//                            System.out.println("W+ "+size);
View Full Code Here

            Excerpt excerpt = sink.createExcerpt();
            try {
                for (int i = 0; i < WARMUP + RUNS; i++) {
                    do {
                        /* busy wait */
                    } while (!excerpt.index(i));
                    long next = excerpt.readLong();
                    long took = System.nanoTime() - next;
                    if (i >= WARMUP)
                        histo.sample(took);
                    else
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.