[jboss-svn-commits] JBL Code SVN: r30587 - labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Dec 11 00:29:47 EST 2009
Author: tcunning
Date: 2009-12-11 00:29:46 -0500 (Fri, 11 Dec 2009)
New Revision: 30587
Modified:
labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
Log:
JBESB-2993
Add the service's description as an attribute to the service mbean.
Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2009-12-11 05:29:06 UTC (rev 30586)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java 2009-12-11 05:29:46 UTC (rev 30587)
@@ -76,7 +76,8 @@
private Hashtable<String, Long> actionLengthThresholdHash;
private Hashtable<String, Long> actionTimeThresholdHash;
-
+
+ private String serviceDescription = "";
private String[] actionNames;
private final ObjectName listObjectName ;
@@ -95,7 +96,6 @@
public static final String ACTION_LENGTH_NOTIFICATION_TYPE = "org.jboss.esb.message.action.length.alert";
public static final String ACTION_TIME_NOTIFICATION_TYPE = "org.jboss.esb.message.action.time.alert";
-
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";
@@ -109,6 +109,7 @@
private static final String OVERALL_BYTES_FAILED = "overall failed bytes";
private static final String OVERALL_TIME_PROCESSED = "overall service time processed";
+ private static final String SERVICE_DESCRIPTION = "service description";
private static final String ALERT_TIME = "service alert time";
private static final String ALERT_LENGTH = "service alert length";
private static final String ALERT_TIME_DESC = "set service alert time";
@@ -123,6 +124,14 @@
private static final Logger logger = Logger.getLogger(ServiceMessageCounter.class);
+ public String getDescription() {
+ return serviceDescription;
+ }
+
+ public void setServiceDescription(String serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
+
/**
* Service alert time getter
* @return max message processing time for the service before an alert is fired
@@ -130,7 +139,7 @@
public Long getAlertTime() {
return alertTime;
}
-
+
/**
* Service alert time setter
* @param alertTime max message size passing through service before an alert is fired
@@ -211,6 +220,10 @@
if (f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_TIME_TAG) != null) {
alertTime = new Long(f_config.getAttribute(ListenerTagNames.SERVICE_ALERT_TIME_TAG));
}
+
+ if (f_config.getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG) != null) {
+ serviceDescription = f_config.getAttribute(ListenerTagNames.SERVICE_DESCRIPTION_TAG);
+ }
init(f_config);
ObjectName listObjectName = null ;
@@ -322,7 +335,7 @@
int count = actionCounterHash.size() + actionProcessTimeHash.size()
+ actionFailedCounterHash.size() + actionBytesProcessedHash.size()
+ actionBytesFailedHash.size() + actionLengthThresholdHash.size()
- + actionTimeThresholdHash.size() + 7; // the extra 6 here are overall service count, failed byte size
+ + actionTimeThresholdHash.size() + 8; // the extra 6 here are overall service count, failed byte size
// processed byte size, overall bytes, alert time, and alert
// length
MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[count];
@@ -383,6 +396,11 @@
attrs[counter] = overallTimeProcessed;
counter++;
+ MBeanAttributeInfo description = new MBeanAttributeInfo(SERVICE_DESCRIPTION, "java.lang.String",
+ "Property " + SERVICE_DESCRIPTION, true, false, false);
+ attrs[counter] = description;
+ counter++;
+
try {
Method alertTimeGetter = this.getClass().getMethod("getAlertTime", new Class[0]);
Method alertTimeSetter = this.getClass().getMethod("setAlertTime", new Class[]{Long.class});
@@ -511,6 +529,8 @@
return alertTime;
} else if (ALERT_LENGTH.equals(key)) {
return alertLength;
+ } else if (SERVICE_DESCRIPTION.equals(key)) {
+ return serviceDescription;
} else if (key.endsWith(ACTION_ALERT_LENGTH)) {
String temp = key.replace(" " + ACTION_ALERT_LENGTH, "");
return actionLengthThresholdHash.get(temp);
More information about the jboss-svn-commits
mailing list