Examples of ActiveMQXid


Examples of org.codehaus.activemq.message.ActiveMQXid

    public int prepare(Xid xid) throws XAException {

        // We allow interleaving multiple transactions, so
        // we don't limit prepare to the associated xid.
        ActiveMQXid x;
        //THIS SHOULD NEVER HAPPEN because end(xid, TMSUCCESS) should have been called first
        if (xid == associatedXid) {
//            x = activeXid;
            throw new XAException(XAException.XAER_PROTO);
        } 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);
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

    public void rollback(Xid xid) throws XAException {

        // We allow interleaving multiple transactions, so
        // we don't limit rollback to the associated xid.
        ActiveMQXid x;
        if (xid == associatedXid) {
            //I think this can happen even without an end(xid) call.  Need to check spec.
            x = activeXid;
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

    public void commit(Xid xid, boolean onePhase) throws XAException {
        checkClosedXA();

        // We allow interleaving multiple transactions, so
        // we don't limit commit to the associated xid.
        ActiveMQXid x;
        if (xid == associatedXid) {
            //should never happen, end(xid,TMSUCCESS) must have been previously called
//            x = activeXid;
            throw new XAException(XAException.XAER_PROTO);
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

    public void forget(Xid xid) throws XAException {
        checkClosedXA();

        // We allow interleaving multiple transactions, so
        // we don't limit forget to the associated xid.
        ActiveMQXid x;
        if (xid == associatedXid) {
            //TODO determine if this can happen... I think not.
            x = activeXid;
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setId(this.packetIdGenerator.generateId());
        info.setXid(x);
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

    private void setXid(Xid xid) {
        if (xid != null) {
// associate
            associatedXid = xid;
            activeXid = new ActiveMQXid(xid);
            super.currentTransactionId = activeXid.toLocalTransactionId();
        } else {
// dis-associate
            associatedXid = null;
            activeXid = null;
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

public class VMPreparedTransactionStoreImpl implements PreparedTransactionStore {
    private Map prepared = new ConcurrentHashMap();

    public ActiveMQXid[] getXids() {
        ArrayList list = new ArrayList(prepared.keySet());
        ActiveMQXid answer[] = new ActiveMQXid[list.size()];
        list.toArray(answer);
        return answer;
    }
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

        assertTrue("Should have returned an XATransactionCommend: " + value, value instanceof XATransactionCommand);
    }

    public void testXidSerialization() throws Exception {
        MockXid mockXid = new MockXid(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid = new ActiveMQXid(mockXid);

        byte[] data = serialize(xid);
        Object value = deserialize(data);

        assertEquals("deserialized object is not equal", xid, value);
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

        assertEquals("deserialized object is not equal", xid, value);
    }

    public void testXidEquals() throws Exception {
        MockXid mockXid = new MockXid(new byte[]{1, 2, 3, 4, 5});
        ActiveMQXid xid1 = new ActiveMQXid(mockXid);
        ActiveMQXid xid2 = new ActiveMQXid(mockXid);

        assertEquals("object hashes are not equal", xid1.hashCode(), xid2.hashCode());
        assertEquals("objects are not equal", xid1, xid2);
    }
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

        assertEquals("object hashes are not equal", xid1.hashCode(), xid2.hashCode());
        assertEquals("objects are not equal", xid1, xid2);
    }

    protected XATransactionCommand createXATranasction() throws JMSException {
        ActiveMQXid xid = new ActiveMQXid("01:23:45");
        XATransactionCommand answer = new XATransactionCommand(null, xid, null, null);
        answer.addPostCommitTask(new SendMessageTransactionTask(null, createMessage()));
        return answer;
    }
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = database.browse();
            while (iter.getNext(tuple)) {
                ActiveMQXid xid = (ActiveMQXid) tuple.getKey();
                Transaction transaction = (Transaction) tuple.getValue();
                transactionManager.loadTransaction(xid, transaction);
            }
        }
        catch (IOException e) {
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.