[jboss-cvs] JBossAS SVN: r91449 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/inflow.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 20 17:23:03 EDT 2009


Author: ALRubinger
Date: 2009-07-20 17:23:03 -0400 (Mon, 20 Jul 2009)
New Revision: 91449

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
Log:
[EJBTHREE-1873] MDBs must record invocation statistics on inflow invocations

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2009-07-20 21:21:18 UTC (rev 91448)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/mdb/inflow/MessageInflowLocalProxy.java	2009-07-20 21:23:03 UTC (rev 91449)
@@ -36,6 +36,7 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.ejb3.mdb.MessagingContainer;
+import org.jboss.ejb3.statistics.InvocationStatistics;
 import org.jboss.ejb3.tx.TxUtil;
 import org.jboss.logging.Logger;
 
@@ -120,24 +121,52 @@
       if (trace)
          log.trace("MessageEndpoint " + getProxyString(proxy) + " in use by " + method + " " + inUseThread);
       
+      // Remember the return value
+      final Object returnValue;
+
       // Which operation?
       if (method.getName().equals("release"))
       {
          release(proxy);
-         return null;
+         returnValue = null;
       }
       else if (method.getName().equals("beforeDelivery"))
       {
          before(proxy, container, method, args);
-         return null;
+         returnValue = null;
       }
       else if (method.getName().equals("afterDelivery"))
       {
          after(proxy);
-         return null;
+         returnValue = null;
       }
+      // Real inflow invocation (ie. from MessageListener.onMessage())
       else
-         return delivery(proxy, container, method, args);
+      {
+         // Tell invoke stats we're starting
+         final InvocationStatistics invokeStats = container.getInvokeStats();
+         invokeStats.callIn();
+         try
+         {
+            final long start = System.currentTimeMillis();
+            returnValue = delivery(proxy, container, method, args);
+            final long elapsed = System.currentTimeMillis() - start;
+            invokeStats.updateStats(method, elapsed);
+            if(log.isTraceEnabled())
+            {
+               log.trace("Invocation took " + elapsed + "ms: " + method);
+            }
+         }
+         finally
+         {
+            // Tell invoke stats we're done
+            invokeStats.callOut();
+         }
+
+      }
+
+      // Return
+      return returnValue;
    }
 
    public String toString()




More information about the jboss-cvs-commits mailing list