use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.
the class ShutdownHandlerTest method testRun.
@Test
public void testRun() throws Exception {
String adapterName = nameGenerator.safeUUID();
Adapter adapter = new Adapter();
adapter.setUniqueId(adapterName);
BootstrapProperties boot = bootstrapWithAdapter(adapter);
AdapterManagerMBean mgmtBean = boot.getConfigManager().createAdapter();
try {
mgmtBean.requestStart();
ShutdownHandler shutdown = new ShutdownHandler(boot);
shutdown.run();
} finally {
unregisterQuietly(mgmtBean);
}
}
use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.
the class ShutdownHandlerTest method testForceShutdown.
@Test
public void testForceShutdown() throws Exception {
String adapterName = nameGenerator.safeUUID();
Adapter adapter = new Adapter();
adapter.setUniqueId(adapterName);
BootstrapProperties boot = bootstrapWithAdapter(adapter);
AdapterManagerMBean mgmtBean = boot.getConfigManager().createAdapter();
try {
mgmtBean.requestStart();
HashSet<ObjectName> set = new HashSet(Arrays.asList(mgmtBean.createObjectName(), ObjectName.getInstance(JMX_ADAPTER_TYPE + ID_PREFIX + nameGenerator.safeUUID())));
ShutdownHandler shutdown = new ShutdownHandler(boot);
shutdown.forceShutdown(set);
} finally {
unregisterQuietly(mgmtBean);
}
}
use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.
the class UnifiedBootstrap method createAdapter.
public AdapterManagerMBean createAdapter() throws Exception {
configurationUpdate();
AdapterManagerMBean adapter = bootstrapProperties.getConfigManager().createAdapter(bootstrapProperties.findAdapterResource());
log.info("Adapter created");
return adapter;
}
use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.
the class UnifiedBootstrap method close.
public void close() throws Exception {
AdapterRegistry.close(adapterRegistry.getAdapters());
for (ObjectName objName : adapterRegistry.getAdapters()) {
AdapterManagerMBean manager = JMX.newMBeanProxy(JmxHelper.findMBeanServer(bootstrapProperties), objName, AdapterManagerMBean.class);
manager.unregisterMBean();
}
ManagementComponentFactory.closeCreated(bootstrapProperties, true);
}
use of com.adaptris.core.runtime.AdapterManagerMBean in project interlok by adaptris.
the class ShutdownHandlerTest method testShutdown.
@Test
public void testShutdown() throws Exception {
String adapterName = nameGenerator.safeUUID();
Adapter adapter = new Adapter();
adapter.setUniqueId(adapterName);
BootstrapProperties boot = bootstrapWithAdapter(adapter);
AdapterManagerMBean mgmtBean = boot.getConfigManager().createAdapter();
try {
mgmtBean.requestStart();
HashSet<ObjectName> set = new HashSet(Arrays.asList(mgmtBean.createObjectName(), ObjectName.getInstance(JMX_ADAPTER_TYPE + ID_PREFIX + nameGenerator.safeUUID())));
ShutdownHandler shutdown = new ShutdownHandler(boot);
shutdown.shutdown(set);
} finally {
unregisterQuietly(mgmtBean);
}
}
Aggregations