Package org.codehaus.activemq.message

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


        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

        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

        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

        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

            rs = s.executeQuery();

            while (rs.next()) {
                String xid = rs.getString(1);
                try {
                    list.add(new ActiveMQXid(xid));
                }
                catch (JMSException e) {
                    log.error("Failed to recover prepared transaction due to invalid xid: " + xid, e);
                }
            }
View Full Code Here

            while (rs.next()) {
                String id = rs.getString(1);
                byte data[] = this.getBinaryData(rs, 2);
                try {
                    ActiveMQXid xid = new ActiveMQXid(id);
                    Transaction transaction = XATransactionCommand.fromBytes(data);
                    transactionManager.loadTransaction(xid, transaction);
                }
                catch (Exception e) {
                    log.error("Failed to recover prepared transaction due to invalid xid: " + id, e);
View Full Code Here

              case TxCommand.LOCAL_COMMIT:
              case TxCommand.LOCAL_ROLLBACK:
                  os.writeUTF( (String) command.getTransactionId() );
                  break;
              default:
                  ActiveMQXid xid = (ActiveMQXid) command.getTransactionId();
                xid.write(os);
                break;
            }
            os.close();
            return journal.write(pos.getPacket(), sync);
        }
View Full Code Here

     */
    public void sendTransactedMessage(final BrokerClient client, final String transactionId, final ActiveMQMessage message) throws JMSException {
        Transaction transaction;
        if (message.isXaTransacted()) {
            try {
                transaction = transactionManager.getXATransaction(new ActiveMQXid(transactionId));
            }
            catch (XAException e) {
                throw (JMSException) new JMSException(e.getMessage()).initCause(e);
            }
        }
View Full Code Here

     */
    public void acknowledgeTransactedMessage(final BrokerClient client, final String transactionId, final MessageAck ack) throws JMSException {
        Transaction transaction;
        if (ack.isXaTransacted()) {
            try {
                transaction = transactionManager.getXATransaction(new ActiveMQXid(transactionId));
            }
            catch (XAException e) {
                throw (JMSException) new JMSException(e.getMessage()).initCause(e);
            }
        }
View Full Code Here

TOP

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

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.