Package org.activemq.service

Examples of org.activemq.service.Transaction


     * Prepares an XA Transaciton.
     *
     * @see org.activemq.broker.Broker#prepareTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)
     */
    public int prepareTransaction(BrokerClient client, ActiveMQXid xid) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        return transaction.prepare();
    }
View Full Code Here


     * Rollback an XA Transaction.
     *
     * @see org.activemq.broker.Broker#rollbackTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid)
     */
    public void rollbackTransaction(BrokerClient client, ActiveMQXid xid) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        transaction.rollback();
    }
View Full Code Here

     * Commit an XA Transaction.
     *
     * @see org.activemq.broker.Broker#commitTransaction(org.activemq.broker.BrokerClient, org.activemq.message.ActiveMQXid, boolean)
     */
    public void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase) throws XAException {
        Transaction transaction = transactionManager.getXATransaction(xid);
        transaction.commit(onePhase);
    }
View Full Code Here

     * the Transactio ncan be obtained via TransactionManager.getContexTransaction().
     * @param message
     * @throws JMSException
     */
    private final void associateTransaction(ActiveMQMessage message) throws JMSException {
        Transaction transaction;
        if( message.isPartOfTransaction() ) {
            if (message.isXaTransacted()) {
                try {
                    transaction = transactionManager.getXATransaction((ActiveMQXid) message.getTransactionId());
                }
View Full Code Here

     * the Transactio ncan be obtained via TransactionManager.getContexTransaction().
     * @param ack
     * @throws JMSException
     */
    private void associateTransaction(MessageAck ack) throws JMSException {
        Transaction transaction;
        if( ack.isPartOfTransaction() ) {
            if (ack.isXaTransacted()) {
                try {
                    transaction = transactionManager.getXATransaction((ActiveMQXid) ack.getTransactionId());
                }
View Full Code Here

            addMessage(message, location);
        } else {
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.addMessage(this, message, location);
            tx.addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        addMessage(message, location);
                    }
View Full Code Here

            removeMessage(ack, location);
        } else {
            synchronized( this ) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.removeMessage(this, ack, location);
            tx.addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        removeMessage(ack, location);
                    }
View Full Code Here

            acknowledge(subscription, messageIdentity, location);
        } else {
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            JournalAck ack = new JournalAck(destinationName,subscription,messageIdentity.getMessageID(), tx.getTransactionId());
            transactionStore.acknowledge(this, ack, location);
            tx.addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    synchronized (JournalTopicMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        acknowledge(subscription, messageIdentity, location);
                    }
View Full Code Here

            if( debug )
                log.debug("Journalled in flight message add: "+message.getJMSMessageID()+" at "+location);           
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.addMessage(this, message, location);
            tx.addPostCommitTask(new TransactionTask() {
                public void execute() throws Throwable {
                    if( debug )
                        log.debug("In flight message add commit: "+message.getJMSMessageID()+" at "+location);                       
                    synchronized (JournalMessageStore.this) {
                        inFlightTxLocations.remove(location);
                        addMessage(message, location);
                    }
                }
            });
            tx.addPostRollbackTask(new TransactionTask(){
                public void execute() throws Throwable {
                    if( debug )
                        log.debug("In flight message add rollback: "+message.getJMSMessageID()+" at "+location);                       
                    // TODO Auto-generated method stub
                    synchronized (JournalMessageStore.this) {
View Full Code Here

                log.debug("Journalled in flight message remove: "+ack.getMessageID()+" at "+location);
           
            synchronized( this ) {
                inFlightTxLocations.add(location);
            }
            final Transaction tx = TransactionManager.getContexTransaction();
            transactionStore.removeMessage(this, ack, location);
            tx.addPostCommitTask(new TransactionTask(){
                public void execute() throws Throwable {
                    if( debug )
                        log.debug("In flight message remove commit: "+ack.getMessageID()+" at "+location);

                    synchronized (JournalMessageStore.this) {                       
                        inFlightTxLocations.remove(location);
                        removeMessage(ack, location);
                    }
                }
            });
            tx.addPostRollbackTask(new TransactionTask(){
                public void execute() throws Throwable {
                    // TODO Auto-generated method stub
                    if( debug )
                        log.debug("In flight message remove rollback: "+ack.getMessageID()+" at "+location);
                    synchronized (JournalMessageStore.this) {
View Full Code Here

TOP

Related Classes of org.activemq.service.Transaction

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.