Package org.apache.qpid.server.store

Examples of org.apache.qpid.server.store.Transaction


            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(1L));
        txn.enqueueMessage(mockQueue, new MockMessage(5L));
        txn.commitTran();

        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueId);

        assertEquals("Number of enqueued messages is incorrect", 2, enqueuedIds.size());
        Long val = enqueuedIds.get(0);
View Full Code Here


            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(21L));
        txn.abortTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(22L));
        txn.enqueueMessage(mockQueue, new MockMessage(23L));
        txn.commitTran();

        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueId);

        assertEquals("Number of enqueued messages is incorrect", 2, enqueuedIds.size());
        Long val = enqueuedIds.get(0);
View Full Code Here

            {
                return mockQueueId;
            }
        };

        Transaction txn = log.newTransaction();

        txn.enqueueMessage(mockQueue, new MockMessage(30L));
        txn.commitTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(31L));
        txn.abortTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, new MockMessage(32L));
        txn.commitTran();

        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueId);

        assertEquals("Number of enqueued messages is incorrect", 2, enqueuedIds.size());
        Long val = enqueuedIds.get(0);
View Full Code Here

                    _queueRecoveries.put(queueName, ++count);
                }
                else
                {
                    _logger.warn("Message id " + messageId + " referenced in log as enqueued in queue " + queueName + " is unknown, entry will be discarded");
                    Transaction txn = _store.newTransaction();
                    txn.dequeueMessage(queue, new DummyMessage(messageId));
                    txn.commitTranAsync();
                }
            }
            else
            {
                _logger.warn("Message id " + messageId + " in log references queue with id " + queueId + " which is not in the configuration, entry will be discarded");
                Transaction txn = _store.newTransaction();
                TransactionLogResource mockQueue =
                        new TransactionLogResource()
                        {
                            @Override
                            public UUID getId()
                            {
                                return queueId;
                            }
                        };
                txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
                txn.commitTranAsync();
            }

        }
        catch(AMQException e)
        {
View Full Code Here

    }

    public void dequeue(BaseQueue queue, EnqueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            StoreFuture future;
            if(message.isPersistent() && queue.isDurable())
            {
                if (_logger.isDebugEnabled())
                {
                    _logger.debug("Dequeue of message number " + message.getMessageNumber() + " from transaction log. Queue : " + queue.getName());
                }

                txn = _messageStore.newTransaction();
                txn.dequeueMessage(queue, message);
                future = txn.commitTranAsync();

                txn = null;
            }
            else
            {
View Full Code Here

        }
    }

    public void dequeue(Collection<QueueEntry> queueEntries, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            for(QueueEntry entry : queueEntries)
            {
                ServerMessage message = entry.getMessage();
                BaseQueue queue = entry.getQueue();

                if(message.isPersistent() && queue.isDurable())
                {
                    if (_logger.isDebugEnabled())
                    {
                        _logger.debug("Dequeue of message number " + message.getMessageNumber() + " from transaction log. Queue : " + queue.getName());
                    }

                    if(txn == null)
                    {
                        txn = _messageStore.newTransaction();
                    }

                    txn.dequeueMessage(queue, message);
                }

            }
            StoreFuture future;
            if(txn != null)
            {
                future = txn.commitTranAsync();
                txn = null;
            }
            else
            {
                future = StoreFuture.IMMEDIATE_FUTURE;
View Full Code Here

    }


    public void enqueue(BaseQueue queue, EnqueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            StoreFuture future;
            if(message.isPersistent() && queue.isDurable())
            {
                if (_logger.isDebugEnabled())
                {
                    _logger.debug("Enqueue of message number " + message.getMessageNumber() + " to transaction log. Queue : " + queue.getName());
                }

                txn = _messageStore.newTransaction();
                txn.enqueueMessage(queue, message);
                future = txn.commitTranAsync();
                txn = null;
            }
            else
            {
                future = StoreFuture.IMMEDIATE_FUTURE;
View Full Code Here

    }

    public void enqueue(List<? extends BaseQueue> queues, EnqueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {

            if(message.isPersistent())
            {
                for(BaseQueue queue : queues)
                {
                    if (queue.isDurable())
                    {
                        if (_logger.isDebugEnabled())
                        {
                            _logger.debug("Enqueue of message number " + message.getMessageNumber() + " to transaction log. Queue : " + queue.getName());
                        }
                        if (txn == null)
                        {
                            txn = _messageStore.newTransaction();
                        }

                        txn.enqueueMessage(queue, message);


                    }
                }

            }
            StoreFuture future;
            if (txn != null)
            {
                future = txn.commitTranAsync();
                txn = null;
            }
            else
            {
                future = StoreFuture.IMMEDIATE_FUTURE;
View Full Code Here

        immediateAction.postCommit();
    }

    public void dequeue(BaseQueue queue, EnqueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            if(message.isPersistent() && queue.isDurable())
            {
                if (_logger.isDebugEnabled())
                {
                    _logger.debug("Dequeue of message number " + message.getMessageNumber() + " from transaction log. Queue : " + queue.getName());
                }

                txn = _messageStore.newTransaction();
                txn.dequeueMessage(queue, message);
                txn.commitTran();
                txn = null;
            }
            postTransactionAction.postCommit();
            postTransactionAction = null;
        }
View Full Code Here

    }

    public void dequeue(Collection<QueueEntry> queueEntries, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            for(QueueEntry entry : queueEntries)
            {
                ServerMessage message = entry.getMessage();
                BaseQueue queue = entry.getQueue();

                if(message.isPersistent() && queue.isDurable())
                {
                    if (_logger.isDebugEnabled())
                    {
                        _logger.debug("Dequeue of message number " + message.getMessageNumber() + " from transaction log. Queue : " + queue.getName());
                    }

                    if(txn == null)
                    {
                        txn = _messageStore.newTransaction();
                    }

                    txn.dequeueMessage(queue, message);
                }

            }
            if(txn != null)
            {
                txn.commitTran();
                txn = null;
            }
            postTransactionAction.postCommit();
            postTransactionAction = null;
        }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.store.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.