Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.XATransactionInfo


                            MessageAck ack = (MessageAck) packet;
                            consumeMessageAck(ack);
                            break;
                        }
                        case Packet.XA_TRANSACTION_INFO : {
                            XATransactionInfo info = (XATransactionInfo) packet;
                            consumeXATransactionInfo(info);
                            break;
                        }
                        case Packet.TRANSACTION_INFO : {
                            TransactionInfo info = (TransactionInfo) packet;
View Full Code Here


     * @throws java.io.IOException thrown if an error occurs
     */

    public void writePacket(Packet packet, DataOutput dataOut) throws IOException {
        super.writePacket(packet, dataOut);
        XATransactionInfo info = (XATransactionInfo) packet;
        dataOut.writeByte(info.getType());
        switch (info.getType()) {
            case TransactionType.START:
            case TransactionType.PRE_COMMIT:
            case TransactionType.COMMIT:
            case TransactionType.RECOVER:
            case TransactionType.ROLLBACK:
            case TransactionType.END:
            case TransactionType.FORGET:
            case TransactionType.JOIN:
            case TransactionType.COMMIT_ONE_PHASE:
                assert info.getXid() != null;
                info.getXid().write(dataOut);
                break;
            case TransactionType.SET_TX_TIMEOUT:
                dataOut.writeInt(info.getTransactionTimeout());
                break;
            case TransactionType.XA_RECOVER:
                //recover should take a flag.
                break;
            case TransactionType.GET_TX_TIMEOUT:
            case TransactionType.GET_RM_ID:
                break;
            default:
                throw new IllegalArgumentException("Invalid type code: " + info.getType());
        }
    }
View Full Code Here

    /**
     * @return a new Packet instance
     */

    public Packet createPacket() {
        return new XATransactionInfo();
    }
View Full Code Here

     * @throws java.io.IOException
     */

    public void buildPacket(Packet packet, DataInput dataIn) throws IOException {
        super.buildPacket(packet, dataIn);
        XATransactionInfo info = (XATransactionInfo) packet;
        info.setType(dataIn.readByte());
        switch (info.getType()) {
            case TransactionType.START:
            case TransactionType.PRE_COMMIT:
            case TransactionType.COMMIT:
            case TransactionType.RECOVER:
            case TransactionType.ROLLBACK:
            case TransactionType.END:
            case TransactionType.FORGET:
            case TransactionType.JOIN:
            case TransactionType.COMMIT_ONE_PHASE:
                info.setXid(ActiveMQXid.read(dataIn));
                break;
            case TransactionType.SET_TX_TIMEOUT:
                info.setTransactionTimeout(dataIn.readInt());
                break;
            case TransactionType.XA_RECOVER:
                //recover should take a flag.
                break;
            case TransactionType.GET_TX_TIMEOUT:
            case TransactionType.GET_RM_ID:
                break;
            default:
                throw new IllegalArgumentException("Invalid type code: " + info.getType());
        }
    }
View Full Code Here

    /**
     * Get's the resource manager id.
     */
    private String determineResourceManagerId() throws JMSException {

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setType(TransactionInfo.GET_RM_ID);

        ResponseReceipt receipt = (ResponseReceipt) syncSendRequest(info);
        String rmId = (String) receipt.getResult();
        assert rmId != null;
        return rmId;
View Full Code Here

        }

        // associate
        setXid(xid);

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(activeXid);
        info.setType(XATransactionInfo.START);

        try {
            // TODO: we may want to wait for reply..
            // server could fail this request
            this.connection.syncSendPacket(info);
View Full Code Here

        } else {
            //TODO cache the known xids so we don't keep recreating this one??
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
        info.setType(XATransactionInfo.PRE_COMMIT);

        try {
// Find out if the server wants to commit or rollback.
            IntResponseReceipt receipt = (IntResponseReceipt) this.connection.syncSendRequest(info);
            return receipt.getResult();
View Full Code Here

            x = activeXid;
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
        info.setType(XATransactionInfo.ROLLBACK);

        try {
            // Let the server know that the tx is rollback.
            this.connection.syncSendPacket(info);
        } catch (JMSException e) {
View Full Code Here

            throw new XAException(XAException.XAER_PROTO);
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
        info.setType(onePhase ? XATransactionInfo.COMMIT_ONE_PHASE : XATransactionInfo.COMMIT);

        try {
            // Notify the server that the tx was commited back
            this.connection.syncSendPacket(info);
        } catch (JMSException e) {
View Full Code Here

            x = activeXid;
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
        info.setType(XATransactionInfo.FORGET);

        try {
            // Tell the server to forget the transaction.
            this.connection.syncSendPacket(info);
        } catch (JMSException e) {
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.XATransactionInfo

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.