use of org.apache.activemq.ra.ActiveMQEndpointWorker in project tomee by apache.
the class ActiveMQResourceAdapter method addJMxControl.
private void addJMxControl(final BeanContext current, final String name) throws ResourceException {
if (name == null || "false".equalsIgnoreCase(name)) {
return;
}
final ActiveMQEndpointWorker worker = getWorker(current);
final ObjectName jmxName;
try {
jmxName = "true".equalsIgnoreCase(name) ? new ObjectNameBuilder().set("J2EEServer", "openejb").set("J2EEApplication", null).set("EJBModule", current.getModuleID()).set("StatelessSessionBean", current.getEjbName()).set("j2eeType", "control").set("name", current.getEjbName()).build() : new ObjectName(name);
} catch (final MalformedObjectNameException e) {
throw new IllegalArgumentException(e);
}
mbeanNames.put(current, jmxName);
LocalMBeanServer.registerSilently(new MdbJmxControl(worker), jmxName);
log.info("Deployed MDB control for " + current.getDeploymentID() + " on " + jmxName);
}
use of org.apache.activemq.ra.ActiveMQEndpointWorker in project tomee by apache.
the class ActiveMQResourceAdapter method endpointActivation.
@Override
public void endpointActivation(final MessageEndpointFactory endpointFactory, final ActivationSpec activationSpec) throws ResourceException {
final BeanContext current = MdbContainer.current();
if (current != null && "false".equalsIgnoreCase(current.getProperties().getProperty("MdbActiveOnStartup"))) {
if (!equals(activationSpec.getResourceAdapter())) {
throw new ResourceException("Activation spec not initialized with this ResourceAdapter instance (" + activationSpec.getResourceAdapter() + " != " + this + ")");
}
if (!(activationSpec instanceof MessageActivationSpec)) {
throw new NotSupportedException("That type of ActivationSpec not supported: " + activationSpec.getClass());
}
final ActiveMQEndpointActivationKey key = new ActiveMQEndpointActivationKey(endpointFactory, MessageActivationSpec.class.cast(activationSpec));
Map.class.cast(Reflections.get(this, "endpointWorkers")).put(key, new ActiveMQEndpointWorker(this, key) {
});
// we dont want that worker.start();
} else {
super.endpointActivation(endpointFactory, activationSpec);
}
if (current != null) {
addJMxControl(current, current.getProperties().getProperty("MdbJMXControl"));
}
}
Aggregations