[jboss-svn-commits] JBL Code SVN: r14608 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Aug 26 15:18:51 EDT 2007
Author: tcunning
Date: 2007-08-26 15:18:51 -0400 (Sun, 26 Aug 2007)
New Revision: 14608
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
Log:
bug:JBESB-738
Add an overall service counter to ServiceCounterMBean.
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-08-26 19:05:08 UTC (rev 14607)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ActionProcessingPipeline.java 2007-08-26 19:18:51 UTC (rev 14608)
@@ -239,6 +239,7 @@
{
final EPR faultToAddress = DefaultFaultTo.getFaultToAddress(message);
long start = System.nanoTime();
+ serviceMessageCounter.incrementTotalCount();
if (active.get())
{
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2007-08-26 19:05:08 UTC (rev 14607)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2007-08-26 19:18:51 UTC (rev 14608)
@@ -60,12 +60,14 @@
private HashMap<String, Long> actionProcessTimeHash;
private ConfigTree m_config;
private ConfigTree[] actionArray;
+ private Integer serviceCount;
public static final String RESET_COUNTER = "resetCounter";
private static final String MESSAGE_COUNTER = "messages successfully processed count";
private static final String FAILED_MESSAGE_COUNTER = "messages failed count";
private static final String PROCESSING_TIME = "processing time";
-
+ private static final String OVERALL_SERVICE_COUNT = "overall service message count";
+
/**
* Constructor
* @param f_config config tree
@@ -74,6 +76,7 @@
actionCounterHash = new HashMap<String, Integer>();
actionFailedCounterHash = new HashMap<String, Integer>();
actionProcessTimeHash = new HashMap<String, Long>();
+ serviceCount = new Integer(0);
m_config = f_config;
actionArray = m_config.getChildren(ListenerTagNames.ACTION_ELEMENT_TAG);
@@ -97,6 +100,13 @@
}
/**
+ * Increment the total message count of this service.
+ */
+ public void incrementTotalCount() {
+ serviceCount = new Integer(serviceCount.intValue() + 1);
+ }
+
+ /**
* Initialize the hashes by setting the counts and the processing time to an initial value of 0.
*/
public void initHashes() {
@@ -108,6 +118,7 @@
actionFailedCounterHash.put(actionId + " " + FAILED_MESSAGE_COUNTER, new Integer(0));
actionProcessTimeHash.put(actionId + " " + PROCESSING_TIME, new Long(0));
}
+ serviceCount = new Integer(0);
}
/**
@@ -115,6 +126,8 @@
* and in the action process time hash to zero.
*/
public void resetCounter() {
+ serviceCount = new Integer(0);
+
for (String key : actionCounterHash.keySet()) {
actionCounterHash.put(key + " " + MESSAGE_COUNTER, new Integer(0));
}
@@ -137,11 +150,10 @@
public MBeanInfo getMBeanInfo() {
int count = actionCounterHash.size() + actionProcessTimeHash.size()
- + actionFailedCounterHash.size();
+ + actionFailedCounterHash.size() + 1;
MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[count];
int counter = 0;
-
-
+
for (String key : actionCounterHash.keySet()) {
attrs[counter] = new MBeanAttributeInfo(
key, "java.lang.Integer", "Property " + key, true, false, false);
@@ -159,7 +171,14 @@
key, "java.lang.Integer", "Property " + key, true, false, false);
counter++;
}
-
+
+ if (counter > 0) {
+ MBeanAttributeInfo overallCount = new MBeanAttributeInfo(OVERALL_SERVICE_COUNT, "java.lang.Integer",
+ "Property " + OVERALL_SERVICE_COUNT, true, false, false);
+ attrs[counter] = overallCount;
+ counter++;
+ }
+
MBeanOperationInfo[] opers = {
new MBeanOperationInfo(
RESET_COUNTER, "Reset the counter",
@@ -193,6 +212,8 @@
} else if (actionFailedCounterHash.containsKey(key)) {
Integer value = actionFailedCounterHash.get(key);
return value;
+ } else if (OVERALL_SERVICE_COUNT.equals(key)) {
+ return serviceCount;
}
return null;
}
@@ -207,6 +228,9 @@
attributeList.add(at);
}
+ Attribute overallCount = new Attribute(OVERALL_SERVICE_COUNT, serviceCount);
+ attributeList.add(overallCount);
+
for (String key : actionProcessTimeHash.keySet()) {
Long processTotal = actionProcessTimeHash.get(key);
String actionId = key.substring(0, key.indexOf(PROCESSING_TIME));
More information about the jboss-svn-commits
mailing list