Search in sources :

Example 11 with JMSServerManager

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

the class ConnectionFactoryService method stop.

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

        @Override
        public void run() {
            try {
                jmsManager.destroyConnectionFactory(name);
            } catch (Throwable e) {
                MessagingLogger.ROOT_LOGGER.failedToDestroy("connection-factory", name);
            }
            context.complete();
        }
    };
    // Jakarta Messaging 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 12 with JMSServerManager

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

the class ConnectionFactoryService method start.

/**
 * {@inheritDoc}
 */
public synchronized void start(final StartContext context) throws StartException {
    final JMSServerManager jmsManager = jmsServer.getValue();
    final Runnable task = new Runnable() {

        @Override
        public void run() {
            try {
                jmsManager.createConnectionFactory(false, configuration, configuration.getBindings());
                context.complete();
            } catch (Throwable e) {
                context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "connection-factory"));
            }
        }
    };
    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 13 with JMSServerManager

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

the class JMSQueueService method start.

@Override
public synchronized void start(final StartContext context) throws StartException {
    final JMSServerManager jmsManager = jmsServer.getValue();
    final Runnable task = new Runnable() {

        @Override
        public void run() {
            try {
                // add back the jms.queue. prefix to be consistent with ActiveMQ Artemis 1.x addressing scheme
                jmsManager.createQueue(false, JMS_QUEUE_PREFIX + queueName, queueName, selectorString, durable);
                JMSQueueService.this.queue = ActiveMQDestination.createQueue(JMS_QUEUE_PREFIX + queueName, queueName);
                context.complete();
            } catch (Throwable e) {
                context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "JMS Queue"));
            }
        }
    };
    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)13 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)6 OperationFailedException (org.jboss.as.controller.OperationFailedException)3 ServiceName (org.jboss.msc.service.ServiceName)3 PathAddress (org.jboss.as.controller.PathAddress)2 ContextNames (org.jboss.as.naming.deployment.ContextNames)2 ArrayList (java.util.ArrayList)1 Connection (javax.jms.Connection)1 ConnectionFactory (javax.jms.ConnectionFactory)1 Queue (javax.jms.Queue)1 Topic (javax.jms.Topic)1 Context (javax.naming.Context)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 RoutingType (org.apache.activemq.artemis.api.core.RoutingType)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)1 OperationContext (org.apache.activemq.artemis.core.persistence.OperationContext)1 StompConnection (org.apache.activemq.artemis.core.protocol.stomp.StompConnection)1 JndiBindingRegistry (org.apache.activemq.artemis.core.registry.JndiBindingRegistry)1 InVMConnectorFactory (org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)1