Package com.taobao.metamorphosis.server.store

Examples of com.taobao.metamorphosis.server.store.AppendCallback


            // ��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��������Ϣ�����
                    allMsgs.add(new MessageInfo(msgId, location.getOffset() + 1044, partition));
View Full Code Here


                        // û�������Ϣ����Ҫ�������
                        final List<Long> idList = entry.getValue();
                        final List<PutCommand> cmdList = putCmds.get(msgStore);
                        if (addedLocation == null) {
                            counter.incrementAndGet();
                            msgStore.append(idList, cmdList, new AppendCallback() {
                                @Override
                                public void appendComplete(final Location newLocation) {
                                    replayed.set(true);
                                    final int checksum =
                                            CheckSum.crc32(MessageUtils.makeMessageBuffer(idList, cmdList).array());
                                    locations.put(msgStore.getDescription(),
                                        new AddMsgLocation(newLocation.getOffset(), newLocation.getLength(), checksum,
                                            msgStore.getDescription()));
                                    counter.decrementAndGet();
                                }
                            });

                        }
                        else {
                            // �����ط�
                            counter.incrementAndGet();
                            msgStore.replayAppend(addedLocation.getOffset(), addedLocation.getLength(),
                                addedLocation.checksum, idList, cmdList, new AppendCallback() {
                                @Override
                                public void appendComplete(final Location newLocation) {
                                    // ����طŵ�ʱ�������λ�ã�����Ҫ����λ����Ϣ
                                    if (newLocation != null) {
                                        replayed.set(true);
View Full Code Here

        for (final Map.Entry<MessageStore, List<Long>> entry : msgIds.entrySet()) {
            final MessageStore msgStore = entry.getKey();
            final List<Long> ids = entry.getValue();
            final List<PutCommand> cmds = putCommands.get(msgStore);
            // Append message
            msgStore.append(ids, cmds, new AppendCallback() {

                @Override
                public void appendComplete(final Location location) {
                    // Calculate checksum
                    final int checkSum = CheckSum.crc32(MessageUtils.makeMessageBuffer(ids, cmds).array());
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.server.store.AppendCallback

Copyright © 2018 www.massapicom. 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.