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();
}
}
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();
}
}
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();
}
}
Aggregations