[jboss-svn-commits] JBL Code SVN: r14654 - labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Aug 27 13:20:54 EDT 2007
Author: tcunning
Date: 2007-08-27 13:20:54 -0400 (Mon, 27 Aug 2007)
New Revision: 14654
Modified:
labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksMessageCounter.java
Log:
bug:JBESB-669
Fix resetCounter method so it doesn't duplicate keys.
Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksMessageCounter.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksMessageCounter.java 2007-08-27 16:44:49 UTC (rev 14653)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksMessageCounter.java 2007-08-27 17:20:54 UTC (rev 14654)
@@ -66,7 +66,6 @@
private HashMap<String, Integer> actionFailedCounterHash;
private HashMap<String, Long> actionProcessTimeHash;
private ConfigTree m_config;
- private ConfigTree[] actionArray;
private Integer serviceCount;
public static final String RESET_COUNTER = "resetCounter";
@@ -87,7 +86,6 @@
serviceCount = new Integer(0);
m_config = f_config;
- actionArray = m_config.getChildren(ListenerTagNames.ACTION_ELEMENT_TAG);
}
/**
@@ -112,15 +110,15 @@
serviceCount = new Integer(0);
for (String key : actionCounterHash.keySet()) {
- actionCounterHash.put(key + " " + MESSAGE_COUNTER, new Integer(0));
+ actionCounterHash.put(key, new Integer(0));
}
for (String key : actionFailedCounterHash.keySet()) {
- actionFailedCounterHash.put(key + " " + FAILED_MESSAGE_COUNTER, new Integer(0));
+ actionFailedCounterHash.put(key, new Integer(0));
}
for (String key : actionProcessTimeHash.keySet()) {
- actionProcessTimeHash.put(key + " " + PROCESSING_TIME, new Long(0));
+ actionProcessTimeHash.put(key, new Long(0));
}
}
@@ -155,12 +153,10 @@
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++;
- }
+ 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(
@@ -301,13 +297,13 @@
*/
public void initMessageProfile(String messageProfile) {
if (!actionProcessTimeHash.containsKey(messageProfile + " " + PROCESSING_TIME)) {
- actionProcessTimeHash.put(messageProfile + " " + PROCESSING_TIME, new Long(0));
+ actionProcessTimeHash.put(messageProfile, new Long(0));
}
if (!actionCounterHash.containsKey(messageProfile + " " + MESSAGE_COUNTER)) {
- actionCounterHash.put(messageProfile + " " + MESSAGE_COUNTER, new Integer(0));
+ actionCounterHash.put(messageProfile, new Integer(0));
}
if (!actionFailedCounterHash.containsKey(messageProfile + " " + FAILED_MESSAGE_COUNTER)) {
- actionCounterHash.put(messageProfile + " " + FAILED_MESSAGE_COUNTER, new Integer(0));
+ actionCounterHash.put(messageProfile, new Integer(0));
}
}
@@ -324,15 +320,31 @@
}
if (TRANSFORM_SUCCEED.equals(status)) {
- Integer count = actionCounterHash.get(messageProfile + " " + MESSAGE_COUNTER);
- count = count.intValue() + 1;
+ Integer count = null;
+ Long time = null;
+ if (actionCounterHash.containsKey(messageProfile + " " + MESSAGE_COUNTER)) {
+ count = actionCounterHash.get(messageProfile + " " + MESSAGE_COUNTER);
+ count = count.intValue() + 1;
+ } else {
+ count = new Integer(1);
+ }
actionCounterHash.put(messageProfile + " " + MESSAGE_COUNTER, count);
- Long time = actionProcessTimeHash.get(messageProfile + " " + PROCESSING_TIME);
- time = time.longValue() + procTime;
+
+ if (actionProcessTimeHash.containsKey(messageProfile + " " + PROCESSING_TIME)) {
+ time = actionProcessTimeHash.get(messageProfile + " " + PROCESSING_TIME);
+ time = time.longValue() + procTime;
+ } else {
+ time = procTime;
+ }
actionProcessTimeHash.put(messageProfile + " " + PROCESSING_TIME, time);
} else if (TRANSFORM_FAILED.equals(status)) {
- Integer count = actionFailedCounterHash.get(messageProfile + " " + FAILED_MESSAGE_COUNTER);
- count = count.intValue() + 1;
+ Integer count = null;
+ if (actionFailedCounterHash.containsKey(messageProfile + " " + FAILED_MESSAGE_COUNTER)) {
+ count = actionFailedCounterHash.get(messageProfile + " " + FAILED_MESSAGE_COUNTER);
+ count = count.intValue() + 1;
+ } else {
+ count = new Integer(1);
+ }
actionFailedCounterHash.put(messageProfile + " " + FAILED_MESSAGE_COUNTER, count);
}
}
More information about the jboss-svn-commits
mailing list