Package com.taobao.metamorphosis.utils

Examples of com.taobao.metamorphosis.utils.IdWorker.nextId()


        assertEquals(2048, store2.getMinOffset());

        final IdWorker idWorker = new IdWorker(0);
        final PutCommand cmd1 = new PutCommand(topic, partition, "hello".getBytes(), null, 0, 0);
        final PutCommand cmd2 = new PutCommand(topic, partition, "world".getBytes(), null, 0, 0);
        store1.append(idWorker.nextId(), cmd1, new AppendCallback() {

            @Override
            public void appendComplete(final Location location) {
                assertEquals(2048, location.getOffset());
View Full Code Here


            }
        });
        store1.flush();// flushһ��
        final long size = store1.getSegments().last().size();
        store1.append(idWorker.nextId(), cmd2, new AppendCallback() {
            @Override
            public void appendComplete(final Location location) {
                assertEquals(2048 + size, location.getOffset());

            }
View Full Code Here

        final CountDownLatch latch = new CountDownLatch(1000);
        for (int i = 0; i < 10; i++) {
            final MessageStore store = this.messageStoreManager.getOrCreateMessageStore(topic, i);
            for (int j = 0; j < 100; j++) {
                final PutCommand cmd = new PutCommand(topic, i, new byte[1024], null, 0, 0);
                final long id = idWorker.nextId();
                store.append(id, cmd, new AppendCallback() {

                    @Override
                    public void appendComplete(Location location) {
                        if (location == Location.InvalidLocaltion) {
View Full Code Here

        final IdWorker idWorker = new IdWorker(0);
        final byte[] data = new byte[1024];
        final PutCommand cmd1 = new PutCommand(topic, partition, data, null, 0, 0);
        final PutCommand cmd2 = new PutCommand(topic, partition, data, null, 0, 0);
        store.append(idWorker.nextId(), cmd1, new AppendCallback() {

            @Override
            public void appendComplete(final Location location) {
                assertEquals(0, location.getOffset());
View Full Code Here

                assertEquals(0, location.getOffset());

            }
        });
        store.flush();// flushһ��
        store.append(idWorker.nextId(), cmd2, new AppendCallback() {
            @Override
            public void appendComplete(final Location location) {
                assertEquals(1044, location.getOffset());

            }
View Full Code Here

        for (int i = 0; i < 20000; i++) {
            // ��5����������Ϊ��
            final int partition = i % 4;
            final int step = i;
            final MessageStore store = metaBroker.getStoreManager().getOrCreateMessageStore(topic, partition);
            final long msgId = idWorker.nextId();
            store.append(msgId, new PutCommand(topic, partition, data, null, 0, 0), new AppendCallback() {

                @Override
                public void appendComplete(final Location location) {
                    // �������1044����Ϊlocation��offset��������Ϣ�����
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.