Examples of ActiveMQXid


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 (ActiveMQXid.equals(associatedXid,xid)) {
            //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.setXid(x);
        info.setType(onePhase ? XATransactionInfo.COMMIT_ONE_PHASE : XATransactionInfo.COMMIT);
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 (ActiveMQXid.equals(associatedXid,xid)) {
            //TODO determine if this can happen... I think not.
            x = activeXid;
        } else {
            x = new ActiveMQXid(xid);
        }

        XATransactionInfo info = new XATransactionInfo();
        info.setXid(x);
        info.setType(XATransactionInfo.FORGET);
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;
        } else {
// dis-associate
            associatedXid = null;
            activeXid = null;
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

     * @see org.codehaus.activemq.service.TransactionManager#getPreparedXATransactions()
     */
    public ActiveMQXid[] getPreparedXATransactions() throws XAException {
        ArrayList txs = new ArrayList(xaTxs.size());
        for (Iterator iter = xaTxs.keySet().iterator(); iter.hasNext();) {
            ActiveMQXid tx = (ActiveMQXid) iter.next();
            txs.add(tx);
        }
        ActiveMQXid rc[] = new ActiveMQXid[txs.size()];
        txs.toArray(rc);
        return rc;
    }
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

        if (ba.get(ActiveMQMessage.CLUSTER_NAME_INDEX)) {
            super.writeUTF(msg.getEntryClusterName(), dataOut);
        }
        if (ba.get(ActiveMQMessage.TRANSACTION_ID_INDEX)) {
            if( ba.get(ActiveMQMessage.XA_TRANS_INDEX) ) {
                ActiveMQXid xid = (ActiveMQXid) msg.getTransactionId();
                xid.write(dataOut);
            } else {
                super.writeUTF((String) msg.getTransactionId(), dataOut);
            }           
        }
       
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

              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

Examples of org.codehaus.activemq.message.ActiveMQXid

    private void consumeXATransactionInfo(XATransactionInfo info) throws JMSException, XAException {
        if (info.getType() == XATransactionInfo.START) {
            this.brokerConnector.startTransaction(this, info.getXid());
        }
        else if (info.getType() == XATransactionInfo.XA_RECOVER) {
            ActiveMQXid rc[] = this.brokerConnector.getPreparedTransactions(this);
            // We will be sending our own receipt..
            info.setReceiptRequired(false);
            // Send the receipt..
            ResponseReceipt receipt = new ResponseReceipt();
            receipt.setCorrelationId(info.getId());
View Full Code Here

Examples of org.codehaus.activemq.message.ActiveMQXid

     */
    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

Examples of org.codehaus.activemq.message.ActiveMQXid

     */
    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

Examples of org.codehaus.activemq.message.ActiveMQXid

            cursor = database.openCursor(BDbHelper.getTransaction(), cursorConfig);
            DatabaseEntry keyEntry = new DatabaseEntry();
            DatabaseEntry valueEntry = new DatabaseEntry();
            OperationStatus status = cursor.getFirst(keyEntry, valueEntry, LockMode.DEFAULT);
            while (status == OperationStatus.SUCCESS) {
                ActiveMQXid xid = extractXid(keyEntry);
                Transaction transaction = extractTransaction(valueEntry);
                transactionManager.loadTransaction(xid, transaction);
                status = cursor.getNext(keyEntry, valueEntry, LockMode.DEFAULT);
            }
            if (status != OperationStatus.NOTFOUND) {
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.