Search in sources :

Example 1 with BindingsTransactionImpl

use of org.apache.activemq.artemis.core.transaction.impl.BindingsTransactionImpl in project activemq-artemis by apache.

the class QueueImpl method deleteQueue.

@Override
public void deleteQueue(boolean removeConsumers) throws Exception {
    synchronized (this) {
        if (this.queueDestroyed)
            return;
        this.queueDestroyed = true;
    }
    Transaction tx = new BindingsTransactionImpl(storageManager);
    try {
        deleteAllReferences();
        destroyPaging();
        postOffice.removeBinding(name, tx, true);
        if (removeConsumers) {
            for (ConsumerHolder consumerHolder : consumerList) {
                consumerHolder.consumer.disconnect();
            }
        }
        if (isDurable()) {
            storageManager.deleteQueueBinding(tx.getID(), getID());
            tx.setContainsPersistent();
        }
        if (slowConsumerReaperFuture != null) {
            slowConsumerReaperFuture.cancel(false);
        }
        tx.commit();
    } catch (Exception e) {
        tx.rollback();
        throw e;
    } finally {
        if (factory != null) {
            factory.queueRemoved(this);
        }
    }
}
Also used : Transaction(org.apache.activemq.artemis.core.transaction.Transaction) BindingsTransactionImpl(org.apache.activemq.artemis.core.transaction.impl.BindingsTransactionImpl) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

NoSuchElementException (java.util.NoSuchElementException)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 Transaction (org.apache.activemq.artemis.core.transaction.Transaction)1 BindingsTransactionImpl (org.apache.activemq.artemis.core.transaction.impl.BindingsTransactionImpl)1