Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.XATransactionInfo



    public Xid[] recover(int flag) throws XAException {
        checkClosedXA();

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

        try {
            ResponseReceipt receipt = (ResponseReceipt) this.connection.syncSendRequest(info);
            return (ActiveMQXid[]) receipt.getResult();
        } catch (JMSException e) {
View Full Code Here



    public int getTransactionTimeout() throws XAException {
        checkClosedXA();

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

        try {
            // get the tx timeout that was set.
            IntResponseReceipt receipt = (IntResponseReceipt) this.connection.syncSendRequest(info);
            return receipt.getResult();
View Full Code Here


    public boolean setTransactionTimeout(int seconds) throws XAException {
        checkClosedXA();

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setType(XATransactionInfo.SET_TX_TIMEOUT);
        info.setTransactionTimeout(seconds);

        try {
            // Setup the new tx timeout
            this.connection.asyncSendPacket(info);
            return true;
View Full Code Here

        XATransactionInfoReader reader = new XATransactionInfoReader();
        assertTrue(reader.getPacketType() == Packet.XA_TRANSACTION_INFO);
    }

    public void testReadXidPacket() throws Exception {
        XATransactionInfo info = (XATransactionInfo) createXidPacket();

        XATransactionInfoWriter writer = new XATransactionInfoWriter();
        XATransactionInfoReader reader = new XATransactionInfoReader();
        byte[] data = writer.writePacketToByteArray(info);
        XATransactionInfo testInfo = (XATransactionInfo) reader.readPacketFromByteArray(data);

        assertPacket(testInfo, info);
    }
View Full Code Here

        assertPacket(testInfo, info);
    }

    public void testReadNoXidPacket() throws Exception {
        XATransactionInfo info = (XATransactionInfo) createNoXidPacket();

        XATransactionInfoWriter writer = new XATransactionInfoWriter();
        XATransactionInfoReader reader = new XATransactionInfoReader();
        byte[] data = writer.writePacketToByteArray(info);
        XATransactionInfo testInfo = (XATransactionInfo) reader.readPacketFromByteArray(data);

        assertPacket(testInfo, info);
    }
View Full Code Here

        assertPacket(testInfo, info);
    }

    public void testTime() {
        XATransactionInfo info = (XATransactionInfo) createXidPacket();

        XATransactionInfoWriter writer = new XATransactionInfoWriter();
        XATransactionInfoReader reader = new XATransactionInfoReader();
        XATransactionInfo testInfo = null;
        try {
            int count = 100000;
            long startTime = System.currentTimeMillis();
            for (int i = 0; i < count; i++) {
                byte[] data = writer.writePacketToByteArray(info);
View Full Code Here

            fail();
        }
    }

    protected void assertPacket(Packet packet, Packet expected) {
        XATransactionInfo testInfo = (XATransactionInfo) packet;
        XATransactionInfo xaExpected = (XATransactionInfo) expected;
        assertEquals(xaExpected.getType(), testInfo.getType());
        assertEquals(xaExpected.getXid(), testInfo.getXid());
    }
View Full Code Here

        assertEquals(xaExpected.getType(), testInfo.getType());
        assertEquals(xaExpected.getXid(), testInfo.getXid());
    }

    protected void assertValidPacket(Packet packet) {
        XATransactionInfo testInfo = (XATransactionInfo) packet;
        assertEquals(testInfo.getType(), TYPE);
        assertEquals(testInfo.getXid(), XID);
    }
View Full Code Here

    protected Packet createPacket() {
        return createXidPacket();
    }

    protected Packet createXidPacket() {
        XATransactionInfo info = new XATransactionInfo();
        info.setType(TYPE);
        info.setXid(XID);
        return info;
    }
View Full Code Here

        info.setXid(XID);
        return info;
    }

    protected Packet createNoXidPacket() {
        XATransactionInfo info = new XATransactionInfo();
        info.setType(TransactionType.GET_RM_ID);
        return info;
    }
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.