Package org.apache.qpid.server.store

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


    }

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

                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


    }


    public void enqueue(TransactionLogResource queue, EnqueueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            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);
                txn.commitTran();
                txn = null;
            }
            postTransactionAction.postCommit();
            postTransactionAction = null;
        }
View Full Code Here

    }

    public void enqueue(List<? extends BaseQueue> queues, EnqueueableMessage 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);


                    }
                }

            }
            if (txn != null)
            {
                txn.commitTran();
                txn = null;
            }

            postTransactionAction.postCommit();
            postTransactionAction = null;
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 String getName()
                        {
                            return "<<UNKNOWN>>";
                        }

                        @Override
                        public UUID getId()
                        {
                            return queueId;
                        }

                        @Override
                        public boolean isDurable()
                        {
                            return false;
                        }
                    };
            txn.dequeueMessage(mockQueue, new DummyMessage(messageId));
            txn.commitTranAsync();
        }
    }
View Full Code Here

        if(_logger.isDebugEnabled())
        {
            _logger.debug("Performing prepare for DtxBranch " + _xid);
        }

        Transaction txn = _store.newTransaction();
        txn.recordXid(_xid.getFormat(),
                      _xid.getGlobalId(),
                      _xid.getBranchId(),
                      _enqueueRecords.toArray(new Record[_enqueueRecords.size()]),
                      _dequeueRecords.toArray(new Record[_dequeueRecords.size()]));
        txn.commitTran();

        prePrepareTransaction();
    }
View Full Code Here

        if(_transaction != null)
        {
            // prepare has previously been called

            Transaction txn = _store.newTransaction();
            txn.removeXid(_xid.getFormat(), _xid.getGlobalId(), _xid.getBranchId());
            txn.commitTran();

            _transaction.abortTran();
        }

        for(ServerTransaction.Action action : _postTransactionActions)
View Full Code Here


        final MessageMetaData mmd = new MessageMetaData(info, chb);

        StoredMessage storedMessage = _store.addMessage(mmd);
        Transaction txn = _store.newTransaction();
        txn.enqueueMessage(createTransactionLogResource("dummyQ"), createEnqueueableMessage(storedMessage));
        txn.commitTran();
        AMQMessage message = new AMQMessage(storedMessage);

        MessageReference ref = message.newReference();

        assertEquals(1, getStoreMessageCount());
View Full Code Here

        final ContentHeaderBody chb = createPersistentContentHeader();

        final MessageMetaData mmd = new MessageMetaData(info, chb);

        StoredMessage storedMessage = _store.addMessage(mmd);
        Transaction txn = _store.newTransaction();
        txn.enqueueMessage(createTransactionLogResource("dummyQ"), createEnqueueableMessage(storedMessage));
        txn.commitTran();
        AMQMessage message = new AMQMessage(storedMessage);


        MessageReference ref = message.newReference();
View Full Code Here

    }

    public void dequeue(TransactionLogResource queue, EnqueueableMessage message, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            StoreFuture future;
            if(queue.getMessageDurability().persist(message.isPersistent()))
            {
                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<MessageInstance> queueEntries, Action postTransactionAction)
    {
        Transaction txn = null;
        try
        {
            for(MessageInstance entry : queueEntries)
            {
                ServerMessage message = entry.getMessage();
                TransactionLogResource queue = entry.getOwningResource();

                if(queue.getMessageDurability().persist(message.isPersistent()))
                {
                    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

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.