[jboss-cvs] JBossAS SVN: r93324 - projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/handler/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 9 14:22:20 EDT 2009


Author: ALRubinger
Date: 2009-09-09 14:22:20 -0400 (Wed, 09 Sep 2009)
New Revision: 93324

Modified:
   projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/handler/session/SessionProxyInvocationHandlerBase.java
Log:
[EJBTHREE-1913] Add a check if the proxy request may be serviced by the handler, avoiding unnecessary object construction and exceptions for flow control

Modified: projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/handler/session/SessionProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/handler/session/SessionProxyInvocationHandlerBase.java	2009-09-09 17:59:42 UTC (rev 93323)
+++ projects/ejb3/trunk/proxy-impl/src/main/java/org/jboss/ejb3/proxy/impl/handler/session/SessionProxyInvocationHandlerBase.java	2009-09-09 18:22:20 UTC (rev 93324)
@@ -157,16 +157,12 @@
       // Obtain an explicitly-specified actual class
       final String actualClass = this.getBusinessInterfaceType();
 
-      // Attempt to handle directly
-      try
+      // If we can service this invocation in the handler itself
+      if (this.canBeHandledDirectly(method))
       {
+         // Handle right here
          return this.handleInvocationDirectly(proxy, args, method);
       }
-      // Ignore this, we just couldn't handle here
-      catch (NotEligibleForDirectInvocationException nefdie)
-      {
-         log.debug("Couldn't handle invocation directly within " + this + ": " + nefdie.getMessage());
-      }
 
       /*
        * Obtain the Container
@@ -258,6 +254,19 @@
    }
 
    /**
+    * Returns whether or not this handler is capable of handling the invoked 
+    * method request directly, without passing along to the container
+    * @param invokedMethod The invoked Method
+    * @return
+    */
+   protected boolean canBeHandledDirectly(final Method invokedMethod)
+   {
+      // We handle: equals, hashCode, toString
+      return (invokedMethod.equals(METHOD_EQUALS) || invokedMethod.equals(METHOD_TO_STRING) || invokedMethod
+            .equals(METHOD_HASH_CODE));
+   }
+
+   /**
     * Handles invocation of "equals(Object)" upon a Session Proxy
     * 
     * EJB 3.0 Specification 3.4.5.1, 3.4.5.2




More information about the jboss-cvs-commits mailing list