You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2017/07/05 09:34:59 UTC
[5/6] tomee git commit: Adding further logging,
and a JMX attribute to show if the MDB has been started or not.
Adding further logging, and a JMX attribute to show if the MDB has been started or not.
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f58a4d1d
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f58a4d1d
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f58a4d1d
Branch: refs/heads/tomee-1.7.x
Commit: f58a4d1d653f3bf0817825b1007c525a30633a95
Parents: 116b82e
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Wed Jun 28 16:16:00 2017 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Wed Jun 28 16:16:00 2017 +0100
----------------------------------------------------------------------
.../org/apache/openejb/core/mdb/MdbContainer.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/f58a4d1d/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
index 87a61c4..8c17e14 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java
@@ -209,6 +209,8 @@ public class MdbContainer implements RpcContainer {
final boolean activeOnStartup = Boolean.parseBoolean(beanContext.getProperties().getProperty("MdbActiveOnStartup", "true"));
if (activeOnStartup) {
activationContext.start();
+ } else {
+ logger.info("Not auto-activating endpoint for " + beanContext.getDeploymentID());
}
final String jmxName = beanContext.getProperties().getProperty("MdbJMXControl", "true");
@@ -527,7 +529,7 @@ public class MdbContainer implements RpcContainer {
private void addJMxControl(final BeanContext current, final String name, final MdbActivationContext activationContext) throws ResourceException {
if (name == null || "false".equalsIgnoreCase(name)) {
- logger.debug("Not adding JMX control for " + current.getDeploymentID() + "/" + current.getEjbName());
+ logger.debug("Not adding JMX control for " + current.getDeploymentID());
return;
}
@@ -608,7 +610,7 @@ public class MdbContainer implements RpcContainer {
resourceAdapter.endpointActivation(endpointFactory, activationSpec);
Thread.currentThread().setContextClassLoader(oldCl);
- logger.info("Activated endpoint for " + beanContext.getDeploymentID() + "/" + beanContext.getEjbName());
+ logger.info("Activated endpoint for " + beanContext.getDeploymentID());
started.set(true);
}
@@ -623,6 +625,8 @@ public class MdbContainer implements RpcContainer {
resourceAdapter.endpointDeactivation(endpointFactory, activationSpec);
Thread.currentThread().setContextClassLoader(oldCl);
+
+ logger.info("Deactivated endpoint for " + beanContext.getDeploymentID());
started.set(false);
}
}
@@ -632,7 +636,9 @@ public class MdbContainer implements RpcContainer {
private static final MBeanInfo INFO = new MBeanInfo(
"org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.MdbJmxControl",
"Allows to control a MDB (start/stop)",
- new MBeanAttributeInfo[0],
+ new MBeanAttributeInfo[]{
+ new MBeanAttributeInfo("started", "boolean", "started: boolean indicating whether this MDB endpoint has been activated.", true, false, true)
+ },
new MBeanConstructorInfo[0],
new MBeanOperationInfo[]{
new MBeanOperationInfo("start", "Ensure the listener is active.", new MBeanParameterInfo[0], "void", ACTION),
@@ -672,6 +678,10 @@ public class MdbContainer implements RpcContainer {
@Override
public Object getAttribute(final String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
+ if ("started".equals(attribute)) {
+ return activationContext.isStarted();
+ }
+
throw new AttributeNotFoundException();
}