[jboss-cvs] JBossAS SVN: r92483 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 18 04:02:43 EDT 2009


Author: ALRubinger
Date: 2009-08-18 04:02:42 -0400 (Tue, 18 Aug 2009)
New Revision: 92483

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
Log:
[EJBTHREE-1885] Record local invocations in metrics

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2009-08-18 07:35:20 UTC (rev 92482)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/session/SessionSpecContainer.java	2009-08-18 08:02:42 UTC (rev 92483)
@@ -123,30 +123,34 @@
       ClassLoader oldLoader = SecurityActions.getContextClassLoader();
 
       SecurityActions.setContextClassLoader(this.getClassloader());
+      
+      /*
+       * Obtain the target method (advised)
+       */
+      Method actualMethod = method.toMethod(this.getClassloader());
+      long hash = MethodHashing.calculateHash(actualMethod);
+      MethodInfo info = getAdvisor().getMethodInfo(hash);
+      if (info == null)
+      {
+         throw new RuntimeException("Method invocation via Proxy could not be found handled for EJB "
+               + this.getEjbName() + " : " + method.toString()
+               + ", probable error in virtual method registration w/ Advisor for the Container");
+      }
+      Method unadvisedMethod = info.getUnadvisedMethod();
+      SerializableMethod unadvisedSerializableMethod = new SerializableMethod(unadvisedMethod);
+      
+      // Mark the start time
+      long start = System.currentTimeMillis();
 
       try
       {
 
          invokedMethod.push(method);
+         
+         // Increment invocation statistics
+         invokeStats.callIn();
 
          /*
-          * Obtain the target method (advised)
-          */
-         Method actualMethod = method.toMethod(this.getClassloader());
-         long hash = MethodHashing.calculateHash(actualMethod);
-         MethodInfo info = getAdvisor().getMethodInfo(hash);
-         if (info == null)
-         {
-            throw new RuntimeException("Method invocation via Proxy could not be found handled for EJB "
-                  + this.getEjbName() + " : " + method.toString()
-                  + ", probable error in virtual method registration w/ Advisor for the Container");
-         }
-         Method unadvisedMethod = info.getUnadvisedMethod();
-         SerializableMethod unadvisedSerializableMethod = new SerializableMethod(unadvisedMethod);
-
-
-
-         /*
           * Invoke directly if this is an EJB2.x Method
           */
 
@@ -178,6 +182,24 @@
       }
       finally
       {
+         /*
+          * Update Invocation Statistics
+          */
+         if (unadvisedMethod != null)
+         {
+            // Mark end time
+            long end = System.currentTimeMillis();
+
+            // Calculate elapsed time
+            long elapsed = end - start;
+
+            // Update statistics with elapsed time
+            invokeStats.updateStats(unadvisedMethod, elapsed);
+         }
+
+         // Complete call to increment statistics
+         invokeStats.callOut();
+         
          invokedMethod.pop();
          SecurityActions.setContextClassLoader(oldLoader);
       }




More information about the jboss-cvs-commits mailing list