[jboss-svn-commits] JBL Code SVN: r24806 - 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
Mon Jan 19 21:51:14 EST 2009


Author: tcunning
Date: 2009-01-19 21:51:14 -0500 (Mon, 19 Jan 2009)
New Revision: 24806

Modified:
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java
Log:
JBESB-2294
Add for service level byte totals.


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	2009-01-20 02:40:31 UTC (rev 24805)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/ServiceMessageCounter.java	2009-01-20 02:51:14 UTC (rev 24806)
@@ -58,8 +58,8 @@
 	private Hashtable<String, IntHolder> actionCounterHash;
 	private Hashtable<String, IntHolder> actionFailedCounterHash;
 	private Hashtable<String, LongHolder> actionProcessTimeHash;
-	private Hashtable<String, IntHolder> actionBytesProcessedHash;
-	private Hashtable<String, IntHolder> actionBytesFailedHash;
+	private Hashtable<String, LongHolder> actionBytesProcessedHash;
+	private Hashtable<String, LongHolder> actionBytesFailedHash;
 	
 	private String[] actionNames;
 	private final ObjectName listObjectName ;
@@ -67,6 +67,7 @@
 	private int serviceCount;
 	private long bytesFailed;
 	private long bytesProcessed;
+	private long bytesOverall;
 	
 	public static final String RESET_COUNTER = "resetCounter";
 	private static final String MESSAGE_COUNTER = "messages successfully processed count";
@@ -76,6 +77,7 @@
 	private static final String BYTES_PROCESSED = "processed bytes";
 	
 	private static final String OVERALL_SERVICE_COUNT = "overall service message count";
+	private static final String OVERALL_BYTES = "overall service count bytes";
 	private static final String OVERALL_BYTES_PROCESSED = "overall processedbytes";
 	private static final String OVERALL_BYTES_FAILED = "overall failed bytes";
 	
@@ -91,8 +93,8 @@
 		actionCounterHash = new Hashtable<String, IntHolder>();
 		actionFailedCounterHash = new Hashtable<String, IntHolder>();
 		actionProcessTimeHash = new Hashtable<String, LongHolder>();
-		actionBytesProcessedHash = new Hashtable<String, IntHolder>();
-		actionBytesFailedHash = new Hashtable<String, IntHolder>();
+		actionBytesProcessedHash = new Hashtable<String, LongHolder>();
+		actionBytesFailedHash = new Hashtable<String, LongHolder>();
 		
 		init(f_config);
 		ObjectName listObjectName = null ;
@@ -144,13 +146,14 @@
 			actionCounterHash.put(actionId + " " + MESSAGE_COUNTER, new IntHolder());
 			actionFailedCounterHash.put(actionId + " " + FAILED_MESSAGE_COUNTER, new IntHolder());
 			actionProcessTimeHash.put(actionId + " " + PROCESSING_TIME, new LongHolder());
-			actionBytesFailedHash.put(actionId + " " + BYTES_FAILED, new IntHolder());
-			actionBytesProcessedHash.put(actionId + " " + BYTES_PROCESSED, new IntHolder());
+			actionBytesFailedHash.put(actionId + " " + BYTES_FAILED, new LongHolder());
+			actionBytesProcessedHash.put(actionId + " " + BYTES_PROCESSED, new LongHolder());
 			actionNames[count] = actionId ;
 		}
 		serviceCount = new Integer(0);
-		bytesProcessed = new Integer(0);
-		bytesFailed = new Integer(0);
+		bytesProcessed = new Long(0);
+		bytesFailed = new Long(0);
+		bytesOverall = new Long(0);
 	}
 	
 	/**
@@ -161,6 +164,7 @@
 		serviceCount = 0 ;
 		bytesProcessed = 0 ;
 		bytesFailed = 0 ;
+		bytesOverall = 0;
 		
 		for (String key : actionCounterHash.keySet()) {
 			actionCounterHash.put(key, new IntHolder());
@@ -175,11 +179,11 @@
 		}
 		
 		for (String key : actionBytesFailedHash.keySet()) {
-			actionBytesFailedHash.put(key, new IntHolder());
+			actionBytesFailedHash.put(key, new LongHolder());
 		}
 		
 		for (String key : actionBytesProcessedHash.keySet()) {
-			actionBytesProcessedHash.put(key, new IntHolder());
+			actionBytesProcessedHash.put(key, new LongHolder());
 		}
 	}
 	
@@ -193,8 +197,8 @@
 		
 		int count = actionCounterHash.size() + actionProcessTimeHash.size()
 			+ actionFailedCounterHash.size() + actionBytesProcessedHash.size() 
-			+ actionBytesFailedHash.size() + 3; // the extra 3 here are overall service count, failed byte size
-												  // and processed byte size
+			+ actionBytesFailedHash.size() + 4; // the extra 4 here are overall service count, failed byte size
+												  // processed byte size, and overall bytes
         MBeanAttributeInfo[] attrs = new MBeanAttributeInfo[count];
         int counter = 0;
               
@@ -218,13 +222,13 @@
 		
 		for (String key : actionBytesFailedHash.keySet()) {
 			attrs[counter] = new MBeanAttributeInfo(
-					key, "java.lang.Integer", "Property " + key, true, false, false);
+					key, "java.lang.Long", "Property " + key, true, false, false);
 			counter++;
 		}
 		
 		for (String key : actionBytesProcessedHash.keySet()) {
 			attrs[counter] = new MBeanAttributeInfo(
-					key, "java.lang.Integer", "Property " + key, true, false, false);
+					key, "java.lang.Long", "Property " + key, true, false, false);
 			counter++;
 		}		
 		
@@ -232,17 +236,22 @@
 				"Property " + OVERALL_SERVICE_COUNT, true, false, false);
 		attrs[counter] = overallCount;
 		counter++;
-
-		MBeanAttributeInfo overallBytesProcessed = new MBeanAttributeInfo(OVERALL_BYTES_PROCESSED, "java.lang.Integer",
+		
+		MBeanAttributeInfo overallBytesProcessed = new MBeanAttributeInfo(OVERALL_BYTES_PROCESSED, "java.lang.Long",
 				"Property " + OVERALL_BYTES_PROCESSED, true, false, false);
 		attrs[counter] = overallBytesProcessed;
 		counter++;
 		
-		MBeanAttributeInfo overallBytesFailed = new MBeanAttributeInfo(OVERALL_BYTES_FAILED, "java.lang.Integer",
+		MBeanAttributeInfo overallBytesFailed = new MBeanAttributeInfo(OVERALL_BYTES_FAILED, "java.lang.Long",
 				"Property " + OVERALL_BYTES_FAILED, true, false, false);
 		attrs[counter] = overallBytesFailed;
 		counter++;
 		
+		MBeanAttributeInfo overallBytes = new MBeanAttributeInfo(OVERALL_BYTES, "java.lang.Long", 
+				"Property " + OVERALL_BYTES, true, false, false);
+		attrs[counter] = overallBytes;
+		counter++;		
+		
         MBeanOperationInfo[] opers = {
         	new MBeanOperationInfo(
         			RESET_COUNTER, "Reset the counter",
@@ -283,6 +292,8 @@
     		return bytesProcessed;
     	} else if (OVERALL_BYTES_FAILED.equals(key)) {
     		return bytesFailed;
+    	} else if (OVERALL_BYTES.equals(key)) {
+    		return bytesOverall;
     	}
     	return null;
     }
@@ -419,18 +430,25 @@
 			count.value++ ;
 			LongHolder time = actionProcessTimeHash.get(actionName + " " + PROCESSING_TIME);
 			time.value += asb.getProcTime();
-			IntHolder bProcessed = actionBytesProcessedHash.get(actionName + " " +  BYTES_PROCESSED);
+			LongHolder bProcessed = actionBytesProcessedHash.get(actionName + " " +  BYTES_PROCESSED);
 			bProcessed.value += asb.getBytesProcessed();
-			bytesProcessed += asb.getBytesProcessed();
+			
+			if (asb.getProcCount() == (actionNames.length-1)) {
+				bytesProcessed += asb.getBytesProcessed();				
+			}
 		} else if (ActionStatusBean.ACTION_FAILED.equals(asb.getStatus())) {
 			IntHolder count = actionFailedCounterHash.get(actionName + " " + FAILED_MESSAGE_COUNTER);
 			count.value++ ;
 			LongHolder time = actionProcessTimeHash.get(actionName + " " + PROCESSING_TIME);
 			time.value += asb.getProcTime();
-			IntHolder bFailed = actionBytesFailedHash.get(actionName + " " +  BYTES_FAILED);
+			LongHolder bFailed = actionBytesFailedHash.get(actionName + " " +  BYTES_FAILED);
 			bFailed.value += asb.getBytesProcessed();
 			bytesFailed += asb.getBytesProcessed();
 		}
+		
+		if (asb.getProcCount() == 0) {
+			bytesOverall += asb.getBytesProcessed();
+		}	
 	}
 	
 	protected ObjectName getObjectName()




More information about the jboss-svn-commits mailing list