Search in sources :

Example 6 with JMSServerManager

use of org.apache.activemq.artemis.jms.server.JMSServerManager in project wildfly by wildfly.

the class JMSQueueService method stop.

@Override
public synchronized void stop(final StopContext context) {
    final JMSServerManager jmsManager = jmsServer.getValue();
    final Runnable task = new Runnable() {

        @Override
        public void run() {
            try {
                jmsManager.removeQueueFromBindingRegistry(queueName);
                queue = null;
            } catch (Throwable e) {
                MessagingLogger.ROOT_LOGGER.failedToDestroy(e, "queue", queueName);
            }
            context.complete();
        }
    };
    // JMS Server Manager uses locking which waits on service completion, use async to prevent starvation
    try {
        executorInjector.getValue().execute(task);
    } catch (RejectedExecutionException e) {
        task.run();
    } finally {
        context.asynchronous();
    }
}
Also used : JMSServerManager(org.apache.activemq.artemis.jms.server.JMSServerManager) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Example 7 with JMSServerManager

use of org.apache.activemq.artemis.jms.server.JMSServerManager in project wildfly by wildfly.

the class JMSTopicService method stop.

@Override
public synchronized void stop(final StopContext context) {
    final JMSServerManager jmsManager = jmsServer.getValue();
    final Runnable task = new Runnable() {

        @Override
        public void run() {
            try {
                jmsManager.removeTopicFromBindingRegistry(name);
                topic = null;
            } catch (Throwable e) {
                MessagingLogger.ROOT_LOGGER.failedToDestroy(e, "jms topic", name);
            }
            context.complete();
        }
    };
    // JMS Server Manager uses locking which waits on service completion, use async to prevent starvation
    try {
        executorInjector.getValue().execute(task);
    } catch (RejectedExecutionException e) {
        task.run();
    } finally {
        context.asynchronous();
    }
}
Also used : JMSServerManager(org.apache.activemq.artemis.jms.server.JMSServerManager) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

JMSServerManager (org.apache.activemq.artemis.jms.server.JMSServerManager)7 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)6 ActiveMQQueue (org.apache.activemq.artemis.jms.client.ActiveMQQueue)1 ActiveMQTopic (org.apache.activemq.artemis.jms.client.ActiveMQTopic)1 OperationContext (org.jboss.as.controller.OperationContext)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)1 PathAddress (org.jboss.as.controller.PathAddress)1 ModelNode (org.jboss.dmr.ModelNode)1 ServiceController (org.jboss.msc.service.ServiceController)1 ServiceName (org.jboss.msc.service.ServiceName)1