Package com.taobao.metamorphosis.server.transaction.store.TransactionCommands

Examples of com.taobao.metamorphosis.server.transaction.store.TransactionCommands.TxCommand


     */
    private int processCmd(final int number, final long offset, final ByteBuffer cmdBuf, final DataFile dataFile)
            throws Exception {
        final byte[] data = new byte[cmdBuf.remaining()];
        cmdBuf.get(data);
        final TxCommand cmd = TxCommand.parseFrom(data);
        if (cmd != null) {
            switch (cmd.getCmdType()) {
            case APPEND_MSG:
                return this.appendMsg(number, offset, cmd, dataFile);
            case TX_OP:
                return this.replayTx(offset, cmdBuf.capacity(), cmd, dataFile);
            }
View Full Code Here


        }
        final TransactionOperation to =
                TransactionOperation.newBuilder().setType(TransactionType.XA_PREPARE)
                .setTransactionId(txid.getTransactionKey()).setWasPrepared(false).build();
        // prepare,����force
        final TxCommand msg =
                TxCommand.newBuilder().setCmdType(TxCommandType.TX_OP).setCmdContent(to.toByteString()).setForce(true)
                .build();
        this.journalStore.write(msg, null, tx.location, false);

        synchronized (this.preparedTransactions) {
View Full Code Here

                        if (locations.size() == count) {
                            // ��λ����Ϣ���л�������Ϊtx
                            // command�ĸ������ݴ洢���ⲿ�����ݵij����ǹ̶��ģ���˿�����replay��ʱ�����
                            final ByteBuffer localtionBytes = AddMsgLocationUtils.encodeLocation(locations);

                            TxCommand msg = null;
                            // Log transaction
                            final int attachmentLen = localtionBytes.remaining();
                            if (txid.isXATransaction()) {
                                final TransactionOperation to = TransactionOperation.newBuilder() //
                                        .setType(TransactionType.XA_COMMIT) //
View Full Code Here

                final TransactionOperation to = TransactionOperation.newBuilder() //
                        .setType(TransactionType.XA_ROLLBACK) //
                        .setTransactionId(txid.getTransactionKey()) //
                        .setWasPrepared(false) //
                        .build();
                final TxCommand msg =
                        TxCommand.newBuilder().setCmdType(TxCommandType.TX_OP).setCmdContent(to.toByteString()).build();
                this.journalStore.write(msg, null, tx.location, true);
            }
            else {
                final TransactionOperation to = TransactionOperation.newBuilder() //
                        .setType(TransactionType.LOCAL_ROLLBACK) //
                        .setTransactionId(txid.getTransactionKey()) //
                        .setWasPrepared(false) //
                        .build();
                final TxCommand msg =
                        TxCommand.newBuilder().setCmdType(TxCommandType.TX_OP).setCmdContent(to.toByteString()).build();
                this.journalStore.write(msg, null, tx.location, true);
            }
        }
    }
View Full Code Here

        if (location == null) {
            // ���طţ����put��־
            final AppendMessageCommand appendCmd =
                    AppendMessageCommand.newBuilder().setMessageId(msgId)
                    .setPutCommand(ByteString.copyFrom(putCmd.encode().array())).build();
            final TxCommand txCommand =
                    TxCommand.newBuilder().setCmdType(TxCommandType.APPEND_MSG).setCmdContent(appendCmd.toByteString())
                    .build();
            final Tx tx = this.getInflyTx(putCmd.getTransactionId());
            if (tx != null) {
                location = this.journalStore.write(txCommand, null, tx.location, false);
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.server.transaction.store.TransactionCommands.TxCommand

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.