Package org.apache.activemq.transaction

Examples of org.apache.activemq.transaction.Synchronization


        // to expand the pre-fetch window
        if (session.isTransacted()) {
            session.doStartTransaction();
            if (!synchronizationRegistered) {
                synchronizationRegistered = true;
                session.getTransactionContext().addSynchronization(new Synchronization() {
                    public void beforeEnd() throws Exception {
                        acknowledge();
                        synchronizationRegistered = false;
                    }
View Full Code Here


        if (context.isInTransaction()) {
            // If this is a transacted message.. increase the usage now so that
            // a big TX does not blow up
            // our memory. This increment is decremented once the tx finishes..
            message.incrementReferenceCount();
            context.getTransaction().addSynchronization(new Synchronization() {
                public void afterCommit() throws Exception {
                    try {
                        // It could take while before we receive the commit
                        // op, by that time the message could have expired..
                        if (broker.isExpired(message)) {
View Full Code Here

        if (!ack.isInTransaction()) {
            node.drop();
            queue.dropEvent();
        } else {
            node.setAcked(true);
            context.getTransaction().addSynchronization(new Synchronization() {
                public void afterCommit() throws Exception {
                    node.drop();
                    queue.dropEvent();
                }
View Full Code Here

        // Handle the standard acknowledgment case.
        boolean wasFull = isFull();
        if (ack.isStandardAck() || ack.isPoisonAck()) {
            if (context.isInTransaction()) {
                prefetchExtension.addAndGet(ack.getMessageCount());
                context.getTransaction().addSynchronization(new Synchronization() {

                    public void afterCommit() throws Exception {
                        synchronized (TopicSubscription.this) {
                            if (singleDestination && destination != null) {
                                destination.getDestinationStatistics().getDequeues().add(ack.getMessageCount());
View Full Code Here

        }

        message.incrementReferenceCount();

        if (context.isInTransaction()) {
            context.getTransaction().addSynchronization(new Synchronization() {
                public void afterCommit() throws Exception {
                    // It could take while before we receive the commit
                    // operration.. by that time the message could have
                    // expired..
                    if (broker.isExpired(message)) {
View Full Code Here

                        removeList.add(node);
                    } else {
                        // setup a Synchronization to remove nodes from the
                        // dispatched list.
                        context.getTransaction().addSynchronization(
                                new Synchronization() {

                                    public void afterCommit() throws Exception {
                                        synchronized (PrefetchSubscription.this) {
                                            dequeueCounter++;
                                            dispatched.remove(node);
View Full Code Here

                MessageAck ack = new MessageAck(md, MessageAck.STANDARD_ACK_TYPE, 1);
                ack.setFirstMessageId(md.getMessage().getMessageId());
                doStartTransaction();
                ack.setTransactionId(getTransactionContext().getTransactionId());
                if (ack.getTransactionId() != null) {
                    getTransactionContext().addSynchronization(new Synchronization() {

                        public void afterRollback() throws Exception {
                            md.getMessage().onMessageRolledBack();
                            // ensure we don't filter this as a duplicate
                            connection.rollbackDuplicate(ActiveMQSession.this, md.getMessage());
View Full Code Here

            }
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            transactionStore.acknowledge(this, ack, location);
            context.getTransaction().addSynchronization(new Synchronization() {

                public void afterCommit() throws Exception {
                    if (debug) {
                        LOG.debug("Transacted acknowledge commit for: " + messageId + ", at: " + location);
                    }
View Full Code Here

            }
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            transactionStore.addMessage(this, message, location);
            context.getTransaction().addSynchronization(new Synchronization() {
                public void afterCommit() throws Exception {
                    if (debug) {
                        LOG.debug("Transacted message add commit for: " + id + ", at: " + location);
                    }
                    synchronized (JournalMessageStore.this) {
View Full Code Here

            }
            synchronized (this) {
                inFlightTxLocations.add(location);
            }
            transactionStore.removeMessage(this, ack, location);
            context.getTransaction().addSynchronization(new Synchronization() {
                public void afterCommit() throws Exception {
                    if (debug) {
                        LOG.debug("Transacted message remove commit for: " + ack.getLastMessageId() + ", at: " + location);
                    }
                    synchronized (JournalMessageStore.this) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.transaction.Synchronization

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.