[jboss-svn-commits] JBL Code SVN: r22879 - in labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners: message and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 18 09:30:16 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-09-18 09:30:16 -0400 (Thu, 18 Sep 2008)
New Revision: 22879
Added:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleAdapter.java
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleControllerMBean.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
Log:
Add listener management: JBESB-2034/JBESB-2038
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/AbstractManagedLifecycle.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -112,8 +112,7 @@
this.config = config;
- lifecycleController = new LifecycleController(this, config);
- lifecycleController.registerMBean();
+ lifecycleController = new LifecycleController(new LifecycleControllerAdapter());
}
/**
@@ -127,23 +126,27 @@
public final void initialise()
throws ManagedLifecycleException
{
- changeState(ManagedLifecycleState.INITIALISING) ;
- try
+ if (!ManagedLifecycleState.INITIALISED.equals(getState()))
{
- doInitialise() ;
- changeState(ManagedLifecycleState.INITIALISED) ;
+ changeState(ManagedLifecycleState.INITIALISING) ;
+ try
+ {
+ doInitialise() ;
+ changeState(ManagedLifecycleState.INITIALISED) ;
+ lifecycleController.registerMBean();
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ changeState(ManagedLifecycleState.DESTROYED) ;
+ throw mle ;
+ }
+ catch (final Exception ex)
+ {
+ logger.warn("Unexpected exception caught while initialisation", ex) ;
+ changeState(ManagedLifecycleState.DESTROYED) ;
+ throw new ManagedLifecycleException(ex) ;
+ }
}
- catch (final ManagedLifecycleException mle)
- {
- changeState(ManagedLifecycleState.DESTROYED) ;
- throw mle ;
- }
- catch (final Exception ex)
- {
- logger.warn("Unexpected exception caught while initialisation", ex) ;
- changeState(ManagedLifecycleState.DESTROYED) ;
- throw new ManagedLifecycleException(ex) ;
- }
}
/**
@@ -163,25 +166,27 @@
public final void start()
throws ManagedLifecycleException
{
- changeState(ManagedLifecycleState.STARTING) ;
- try
+ if (!ManagedLifecycleState.STARTED.equals(getState()))
{
- doStart() ;
- changeState(ManagedLifecycleState.STARTED) ;
- lifecycleController.setStartTime(System.currentTimeMillis());
+ changeState(ManagedLifecycleState.STARTING) ;
+ try
+ {
+ doStart() ;
+ changeState(ManagedLifecycleState.STARTED) ;
+ lifecycleController.setStartTime(System.currentTimeMillis());
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ changeState(ManagedLifecycleState.STOPPED);
+ throw mle ;
+ }
+ catch (final Exception ex)
+ {
+ logger.warn("Unexpected exception caught while starting", ex) ;
+ changeState(ManagedLifecycleState.STOPPED) ;
+ throw new ManagedLifecycleException(ex) ;
+ }
}
- catch (final ManagedLifecycleException mle)
- {
- changeState(ManagedLifecycleState.STOPPED);
- lifecycleController.unsetStartTime();
- throw mle ;
- }
- catch (final Exception ex)
- {
- logger.warn("Unexpected exception caught while starting", ex) ;
- changeState(ManagedLifecycleState.STOPPED) ;
- throw new ManagedLifecycleException(ex) ;
- }
}
/**
@@ -204,25 +209,28 @@
public final void stop()
throws ManagedLifecycleException
{
- changeState(ManagedLifecycleState.STOPPING) ;
- try
+ if (!ManagedLifecycleState.STOPPED.equals(getState()))
{
- doStop() ;
+ changeState(ManagedLifecycleState.STOPPING) ;
+ try
+ {
+ doStop() ;
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ throw mle ;
+ }
+ catch (final Exception ex)
+ {
+ logger.warn("Unexpected exception caught while stopping", ex) ;
+ throw new ManagedLifecycleException(ex) ;
+ }
+ finally
+ {
+ changeState(ManagedLifecycleState.STOPPED) ;
+ lifecycleController.unsetStartTime();
+ }
}
- catch (final ManagedLifecycleException mle)
- {
- throw mle ;
- }
- catch (final Exception ex)
- {
- logger.warn("Unexpected exception caught while stopping", ex) ;
- throw new ManagedLifecycleException(ex) ;
- }
- finally
- {
- changeState(ManagedLifecycleState.STOPPED) ;
- lifecycleController.unsetStartTime();
- }
}
/**
@@ -243,25 +251,28 @@
public final void destroy()
throws ManagedLifecycleException
{
- changeState(ManagedLifecycleState.DESTROYING) ;
- try
+ if (!ManagedLifecycleState.DESTROYED.equals(getState()))
{
- doDestroy() ;
+ changeState(ManagedLifecycleState.DESTROYING) ;
+ lifecycleController.unregisterMBean();
+ try
+ {
+ doDestroy() ;
+ }
+ catch (final ManagedLifecycleException mle)
+ {
+ throw mle ;
+ }
+ catch (final Exception ex)
+ {
+ logger.warn("Unexpected exception caught while destroying", ex) ;
+ throw new ManagedLifecycleException(ex) ;
+ }
+ finally
+ {
+ changeState(ManagedLifecycleState.DESTROYED) ;
+ }
}
- catch (final ManagedLifecycleException mle)
- {
- throw mle ;
- }
- catch (final Exception ex)
- {
- logger.warn("Unexpected exception caught while destroying", ex) ;
- throw new ManagedLifecycleException(ex) ;
- }
- finally
- {
- changeState(ManagedLifecycleState.DESTROYED) ;
- lifecycleController.unsetStartTime();
- }
}
/**
@@ -477,4 +488,52 @@
{
return config;
}
+
+ private final class LifecycleControllerAdapter implements ManagedLifecycleAdapter
+ {
+ /**
+ * Start the managed instance.
+ * <p/>
+ * This method is called to inform the managed instance that it can initialise
+ * resources prior to enabling the service.
+ */
+ public void start()
+ throws ManagedLifecycleException
+ {
+ AbstractManagedLifecycle.this.start() ;
+ }
+
+ /**
+ * Stop the managed instance.
+ * <p/>
+ * This method is called to inform the managed instance that it must disable
+ * resources associated with the running service. The service may choose to
+ * disable the resources asynchronously provided that any subsequent call to
+ * {@link #start()} or {@link #destroy()} blocks until these resources have been
+ * disabled.
+ */
+ public void stop()
+ throws ManagedLifecycleException
+ {
+ AbstractManagedLifecycle.this.stop() ;
+ }
+
+ /**
+ * Get the state of the managed instance.
+ * @return The managed instance state.
+ */
+ public ManagedLifecycleState getState()
+ {
+ return AbstractManagedLifecycle.this.getState() ;
+ }
+
+ /**
+ * Get the configuration assoicated with the ManagedLifecycle.
+ * @return Configuration.
+ */
+ public ConfigTree getConfig()
+ {
+ return AbstractManagedLifecycle.this.getConfig() ;
+ }
+ }
}
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleController.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -56,9 +56,9 @@
* @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
*/
public class LifecycleController implements DynamicMBean {
- private ManagedLifecycle m_lifecycle;
- private ConfigTree m_config;
+ private ManagedLifecycleAdapter m_lifecycle;
private String m_startTime;
+ private final ObjectName listObjectName ;
private static final Logger logger = Logger.getLogger(LifecycleController.class);
@@ -66,20 +66,18 @@
public static final String STARTTIME_ATTRIB = "StartDate";
public static final String XML_ATTRIB = "ListenerXMLAsHtml";
- public static final String INIT_ACTION = "initialise";
public static final String START_ACTION = "start";
public static final String STOP_ACTION = "stop";
- public static final String DESTROY_ACTION = "destroy";
/**
* Constructor using lifecycle and config tree.
* @param f_lifecycle lifecycle
* @param f_configtree config tree
*/
- public LifecycleController(ManagedLifecycle f_lifecycle, ConfigTree f_configtree) {
+ public LifecycleController(ManagedLifecycleAdapter f_lifecycle) {
m_lifecycle = f_lifecycle;
- m_config = f_configtree;
m_startTime = "";
+ listObjectName = getObjectName() ;
}
/**
@@ -102,7 +100,7 @@
* Lifecycle mutator.
* @param f_aml lifecycle
*/
- public void setLifecycle(ManagedLifecycle f_aml) {
+ public void setLifecycle(ManagedLifecycleAdapter f_aml) {
m_lifecycle = f_aml;
}
@@ -111,32 +109,10 @@
* @return configtree XML
*/
public String getListenerXMLAsHtml() {
- return m_config.toXml().replace("<", "<").replace(">", ">");
+ return m_lifecycle.getConfig().toXml().replace("<", "<").replace(">", ">");
}
/**
- * ConfigTree mutator.
- * @param f_ct config tree
- */
- public void setConfigTree(ConfigTree f_ct) {
- m_config = f_ct;
- }
-
- /**
- * Calls destroy on the lifecycle.
- */
- public void destroy() throws ManagedLifecycleException {
- m_lifecycle.destroy();
- }
-
- /**
- * Calls initialise on the lifecycle.
- */
- public void initialise() throws ManagedLifecycleException {
- m_lifecycle.initialise();
- }
-
- /**
* Calls start on the lifecycle.
*/
public void start() throws ManagedLifecycleException {
@@ -154,6 +130,9 @@
* Register this MBean with JBoss.
*/
protected void registerMBean() {
+ if (listObjectName == null) {
+ return ;
+ }
MBeanServer mbeanServer = null;
try {
mbeanServer = MBeanServerLocator.locateJBoss();
@@ -163,55 +142,8 @@
return;
}
- ObjectName listObjectName = null;
try {
- String categoryName = m_config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
- String serviceName = m_config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
- String listenerName = m_config.getName();
-
- StringBuffer objectName = new StringBuffer();
- if (categoryName != null) {
- objectName.append(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG + "=" + categoryName);
- }
-
- if (serviceName != null) {
- if (objectName.length() > 0) {
- objectName.append(",");
- }
- objectName.append(ListenerTagNames.SERVICE_NAME_TAG + "=" + serviceName);
- }
-
- if (listenerName != null) {
- if (objectName.length() > 0) {
- objectName.append(",");
- }
- if ("true".equals(m_config.getAttribute(ListenerTagNames.IS_GATEWAY_TAG))) {
- objectName.append("gateway-name=" + listenerName);
- } else {
- objectName.append("listener-name=" + listenerName);
- }
-
- }
-
- listObjectName = new ObjectName("jboss.esb:" + objectName.toString());
- } catch (MalformedObjectNameException e1) {
- logger.error("", e1);
- } catch (NullPointerException e1) {
- logger.error("", e1);
- }
-
- if (mbeanServer.isRegistered(listObjectName)) {
- try {
- mbeanServer.unregisterMBean(listObjectName);
- } catch (InstanceNotFoundException e) {
- logger.error("", e);
- } catch (MBeanRegistrationException e) {
- logger.error("", e);
- }
- }
-
- try {
- mbeanServer.registerMBean(this, listObjectName);
+ mbeanServer.registerMBean(this, listObjectName);
} catch (InstanceAlreadyExistsException e) {
logger.error("", e);
} catch (MBeanRegistrationException e) {
@@ -222,15 +154,41 @@
}
/**
+ * Unregister this MBean with JBoss.
+ */
+ protected void unregisterMBean() {
+ if (listObjectName == null) {
+ return ;
+ }
+ MBeanServer mbeanServer = null;
+ try {
+ mbeanServer = MBeanServerLocator.locateJBoss();
+ } catch (IllegalStateException ise) {
+ // If we can't find a JBoss MBeanServer, just return
+ // Needed for unit tests
+ return;
+ }
+
+ try {
+ mbeanServer.unregisterMBean(listObjectName);
+ } catch (InstanceNotFoundException e) {
+ logger.error("", e);
+ } catch (MBeanRegistrationException e) {
+ logger.error("", e);
+ }
+ }
+
+ /**
* Gets the list of attributes. We return all Lifecycle attributes from the ConfigTree,
* and the start time, configtree XML, and the lifecycle state.
*/
public AttributeList getAttributes(String[] arg0) {
+ final ConfigTree config = m_lifecycle.getConfig() ;
AttributeList attributeList = new AttributeList();
- Set<String> set = m_config.getAttributeNames();
+ Set<String> set = config.getAttributeNames();
String[] attribs = (String[])set.toArray(new String[set.size()]);
for (int i = 0; i < attribs.length; i++) {
- Attribute at = new Attribute(attribs[i], m_config.getAttribute(attribs[i]));
+ Attribute at = new Attribute(attribs[i], config.getAttribute(attribs[i]));
attributeList.add(at);
}
@@ -259,7 +217,7 @@
} else if (name.equals(XML_ATTRIB)) {
value = getListenerXMLAsHtml();
} else {
- value = m_config.getAttribute(name);
+ value = m_lifecycle.getConfig().getAttribute(name);
}
if (value != null)
return value;
@@ -275,7 +233,7 @@
*/
public MBeanInfo getMBeanInfo() {
SortedSet<String> names = new TreeSet<String>();
- for (Object name : m_config.getAttributeNames())
+ for (Object name : m_lifecycle.getConfig().getAttributeNames())
names.add((String) name);
names.add(LIFECYCLESTATE_ATTRIB);
names.add(STARTTIME_ATTRIB);
@@ -288,9 +246,6 @@
name, "java.lang.String", "Property " + name, true, false, false);
}
MBeanOperationInfo[] opers = {
- new MBeanOperationInfo(
- INIT_ACTION, "Initialise the lifecycle",
- null, "void", MBeanOperationInfo.ACTION),
new MBeanOperationInfo(
START_ACTION, "Start the lifecycle",
null, "void", MBeanOperationInfo.ACTION),
@@ -298,9 +253,6 @@
new MBeanOperationInfo(
STOP_ACTION, "Stop the lifecycle",
null, "void", MBeanOperationInfo.ACTION),
- new MBeanOperationInfo(
- DESTROY_ACTION, "Destroy the lifecycle",
- null, "void", MBeanOperationInfo.ACTION),
};
return new MBeanInfo(
this.getClass().getName(), "Lifecycle Controller MBean",
@@ -322,14 +274,6 @@
return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
- } else if (method.equalsIgnoreCase(INIT_ACTION)) {
- try {
- initialise();
- } catch (ManagedLifecycleException e) {
- logger.error("", e);
- return "Error invoking " + method + ": " + e.toString();
- }
- return "Invoking the " + method + " on the lifecycle.";
} else if (method.equalsIgnoreCase(STOP_ACTION)) {
try {
stop();
@@ -338,14 +282,6 @@
return "Error invoking " + method + ": " + e.toString();
}
return "Invoking the " + method + " on the lifecycle.";
- } else if (method.equalsIgnoreCase(DESTROY_ACTION)) {
- try {
- destroy();
- } catch (ManagedLifecycleException e) {
- logger.error("", e);
- return "Error invoking " + method + ": " + e.toString();
- }
- return "Invoking the " + method + " on the lifecycle.";
} else {
throw new ReflectionException(new NoSuchMethodException(method));
}
@@ -364,5 +300,46 @@
*/
public AttributeList setAttributes(AttributeList arg0) {
return null;
- }
+ }
+
+ protected ObjectName getObjectName()
+ {
+ ObjectName listObjectName = null;
+ try {
+ final ConfigTree config = m_lifecycle.getConfig() ;
+ String categoryName = config.getAttribute(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG);
+ String serviceName = config.getAttribute(ListenerTagNames.SERVICE_NAME_TAG);
+ String listenerName = config.getName();
+
+ StringBuffer objectName = new StringBuffer();
+ if (categoryName != null) {
+ objectName.append(ListenerTagNames.SERVICE_CATEGORY_NAME_TAG + "=" + categoryName);
+ }
+
+ if (serviceName != null) {
+ if (objectName.length() > 0) {
+ objectName.append(",");
+ }
+ objectName.append(ListenerTagNames.SERVICE_NAME_TAG + "=" + serviceName);
+ }
+
+ if (listenerName != null) {
+ if (objectName.length() > 0) {
+ objectName.append(",");
+ }
+ if ("true".equals(config.getAttribute(ListenerTagNames.IS_GATEWAY_TAG))) {
+ objectName.append("gateway-name=" + listenerName);
+ } else {
+ objectName.append("listener-name=" + listenerName);
+ }
+ }
+
+ listObjectName = new ObjectName("jboss.esb:" + objectName.toString());
+ } catch (MalformedObjectNameException e1) {
+ logger.error("", e1);
+ } catch (NullPointerException e1) {
+ logger.error("", e1);
+ }
+ return listObjectName ;
+ }
}
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleControllerMBean.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleControllerMBean.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/LifecycleControllerMBean.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -28,8 +28,6 @@
* @author <a href="mailto:tcunning at redhat.com">tcunning at redhat.com</a>
*/
public interface LifecycleControllerMBean {
- public void initialise() throws ManagedLifecycleException;
public void start() throws ManagedLifecycleException;
public void stop() throws ManagedLifecycleException;
- public void destroy() throws ManagedLifecycleException;
}
Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleAdapter.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleAdapter.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleAdapter.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.soa.esb.listeners.lifecycle;
+
+import org.jboss.soa.esb.helpers.ConfigTree;
+
+/**
+ * Adapter interface used for management through lifecycle MBean
+ */
+public interface ManagedLifecycleAdapter
+{
+ /**
+ * Start the managed instance.
+ * <p/>
+ * This method is called to inform the managed instance that it can initialise
+ * resources prior to enabling the service.
+ */
+ public void start()
+ throws ManagedLifecycleException ;
+
+ /**
+ * Stop the managed instance.
+ * <p/>
+ * This method is called to inform the managed instance that it must disable
+ * resources associated with the running service. The service may choose to
+ * disable the resources asynchronously provided that any subsequent call to
+ * {@link #start()} or {@link #destroy()} blocks until these resources have been
+ * disabled.
+ */
+ public void stop()
+ throws ManagedLifecycleException ;
+
+ /**
+ * Get the state of the managed instance.
+ * @return The managed instance state.
+ */
+ public ManagedLifecycleState getState() ;
+
+ /**
+ * Get the configuration assoicated with the ManagedLifecycle.
+ * @return Configuration.
+ */
+ public ConfigTree getConfig();
+}
\ No newline at end of file
Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/lifecycle/ManagedLifecycleAdapter.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -205,7 +205,6 @@
final ArrayList<ActionPipelineProcessor> processorList = new ArrayList<ActionPipelineProcessor>();
serviceMessageCounter = new ServiceMessageCounter(config);
- serviceMessageCounter.registerMBean();
for (final ConfigTree actionConfig : actionList)
{
@@ -313,6 +312,7 @@
*/
public void initialise() throws ConfigurationException
{
+ serviceMessageCounter.registerMBean();
final int numLifecycles = processors.length;
for (int count = 0; count < numLifecycles; count++)
{
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -255,6 +255,18 @@
+ " finished on thread " + Thread.currentThread().getName());
}
}
+
+ /**
+ * Handle the stop of the managed instance.
+ *
+ * @throws ManagedLifecycleException for errors while stopping.
+ */
+ protected void doStop()
+ throws ManagedLifecycleException
+ {
+ super.doStop();
+ _execService.shutdown() ;
+ }
/**
* We have JMS transactional delivery/work semantics: before pulling a unit of work
@@ -361,22 +373,18 @@
protected void doThreadedDestroy()
throws ManagedLifecycleException
{
- if (_execService != null)
+ try
{
- try
- {
- _execService.shutdown() ;
- checkExecutorTermination() ;
- }
- catch (final ManagedLifecycleException ex)
- {
- throw ex;
- }
- catch (final Throwable ex)
- {
- _logger.warn("Caught throwable during shutdown: "+ex);
- }
+ checkExecutorTermination() ;
}
+ catch (final ManagedLifecycleException ex)
+ {
+ throw ex;
+ }
+ catch (final Throwable ex)
+ {
+ _logger.warn("Caught throwable during shutdown: "+ex);
+ }
pipeline.destroy() ;
pipeline = null ;
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2008-09-18 13:28:09 UTC (rev 22878)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2008-09-18 13:30:16 UTC (rev 22879)
@@ -358,6 +358,9 @@
* Register this MBean with JBoss.
*/
protected void registerMBean() {
+ if (listObjectName == null) {
+ return ;
+ }
MBeanServer mbeanServer = null;
try {
mbeanServer = MBeanServerLocator.locateJBoss();
@@ -382,6 +385,9 @@
* Unregister this MBean with JBoss.
*/
protected void unregisterMBean() {
+ if (listObjectName == null) {
+ return ;
+ }
MBeanServer mbeanServer = null;
try {
mbeanServer = MBeanServerLocator.locateJBoss();
More information about the jboss-svn-commits
mailing list