use of org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl in project activemq-artemis by apache.
the class BridgeTestBase method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
// Start the servers
Configuration conf0 = createBasicConfig().setJournalDirectory(getJournalDir(0, false)).setBindingsDirectory(getBindingsDir(0, false)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY));
server0 = addServer(ActiveMQServers.newActiveMQServer(conf0, false));
context0 = new InVMNamingContext();
jmsServer0 = new JMSServerManagerImpl(server0);
jmsServer0.setRegistry(new JndiBindingRegistry(context0));
jmsServer0.start();
params1 = new HashMap<>();
params1.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
Configuration conf1 = createBasicConfig().setJournalDirectory(getJournalDir(1, false)).setBindingsDirectory(getBindingsDir(1, false)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params1));
server1 = addServer(ActiveMQServers.newActiveMQServer(conf1, false));
context1 = new InVMNamingContext();
jmsServer1 = new JMSServerManagerImpl(server1);
jmsServer1.setRegistry(new JndiBindingRegistry(context1));
jmsServer1.start();
createQueue("sourceQueue", 0);
jmsServer0.createTopic(false, "sourceTopic", "/topic/sourceTopic");
createQueue("localTargetQueue", 0);
createQueue("targetQueue", 1);
setUpAdministeredObjects();
TxControl.enable();
// We need a local transaction and recovery manager
// We must start this after the remote servers have been created or it won't
// have deleted the database and the recovery manager may attempt to recover transactions
}
use of org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl in project activemq-artemis by apache.
the class JMSClusteredTestBase method setupServer2.
/**
* @throws Exception
*/
private void setupServer2() throws Exception {
Configuration configuration = createConfigServer(2, 1);
JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
mBeanServer2 = MBeanServerFactory.createMBeanServer();
server2 = addServer(ActiveMQServers.newActiveMQServer(configuration, mBeanServer2, enablePersistence()));
jmsServer2 = new JMSServerManagerImpl(server2, jmsconfig);
context2 = new InVMNamingContext();
jmsServer2.setRegistry(new JndiBindingRegistry(context2));
}
use of org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl in project activemq-artemis by apache.
the class SyncSendTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
if (storage.equals("null")) {
server = createServer(false, true);
} else {
server = createServer(true, true);
}
jms = new JMSServerManagerImpl(server);
if (storage.equals("libaio")) {
server.getConfiguration().setJournalType(JournalType.ASYNCIO);
} else {
server.getConfiguration().setJournalType(JournalType.NIO);
}
jms.start();
}
use of org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl in project wildfly by wildfly.
the class JMSService method doStart.
private synchronized void doStart(final StartContext context) throws StartException {
final ServiceContainer serviceContainer = context.getController().getServiceContainer();
ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(getClass());
try {
jmsServer = new JMSServerManagerImpl(activeMQServer.getValue(), new WildFlyBindingRegistry(context.getController().getServiceContainer())) {
@Override
public void stop(ActiveMQServer server) {
// Suppress ARTEMIS-2438
}
};
activeMQServer.getValue().registerActivationFailureListener(e -> {
StartException se = new StartException(e);
context.failed(se);
});
activeMQServer.getValue().registerActivateCallback(new ActivateCallback() {
private volatile ServiceController<Void> activeMQActivationController;
public void preActivate() {
}
public void activated() {
if (overrideInVMSecurity) {
activeMQServer.getValue().getRemotingService().allowInvmSecurityOverride(new ActiveMQPrincipal(DefaultCredentials.getUsername(), DefaultCredentials.getPassword()));
}
// ActiveMQ backup server is activated during failover while the WildFly server is shutting down.
if (serviceContainer.isShutdown()) {
return;
}
if (activeMQActivationController == null) {
activeMQActivationController = serviceContainer.addService(ActiveMQActivationService.getServiceName(serverServiceName), new ActiveMQActivationService()).setInitialMode(Mode.ACTIVE).install();
} else {
activeMQActivationController.setMode(ACTIVE);
}
}
@Override
public void activationComplete() {
}
public void deActivate() {
// and *not* during AS7 service container shutdown or reload (AS7-6840 / AS7-6881)
if (activeMQActivationController != null && !activeMQActivationController.getState().in(STOPPING, REMOVED)) {
// [WFLY-4597] When Artemis is deactivated during failover, we block until its
// activation controller is REMOVED before giving back control to Artemis.
// This allow to properly stop any service depending on the activation controller
// and avoid spurious warning messages because the resources used by the services
// are stopped outside the control of the services.
final CountDownLatch latch = new CountDownLatch(1);
activeMQActivationController.compareAndSetMode(ACTIVE, REMOVE);
activeMQActivationController.addListener(new LifecycleListener() {
@Override
public void handleEvent(ServiceController<?> controller, LifecycleEvent event) {
if (event == LifecycleEvent.REMOVED) {
latch.countDown();
}
}
});
try {
latch.await(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
}
activeMQActivationController = null;
}
}
});
jmsServer.start();
} catch (StartException e) {
throw e;
} catch (Throwable t) {
throw new StartException(t);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
}
}
use of org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl in project activemq-artemis by apache.
the class XmlImportExportTest method basicSetUp.
/**
* @return ClientSession
* @throws Exception
*/
private ClientSession basicSetUp() throws Exception {
server = createServer(true);
server.getConfiguration().getConnectorConfigurations().put("in-vm1", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
server.getConfiguration().getConnectorConfigurations().put("in-vm2", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
jmsServer = new JMSServerManagerImpl(server);
addActiveMQComponent(jmsServer);
namingContext = new InVMContext();
jmsServer.setRegistry(new JndiBindingRegistry(namingContext));
jmsServer.start();
locator = createInVMNonHALocator();
factory = createSessionFactory(locator);
checkForLongs();
return addClientSession(factory.createSession(false, true, true));
}
Aggregations