[jboss-cvs] JBossAS SVN: r76737 - in projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler: session and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 7 00:00:52 EDT 2008


Author: ALRubinger
Date: 2008-08-07 00:00:52 -0400 (Thu, 07 Aug 2008)
New Revision: 76737

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java
Log:
[EJBTHREE-1345] Further clean the ProxyInvocationHandler API by abstracting the invokedMethod (pass internally only)

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java	2008-08-07 04:00:19 UTC (rev 76736)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandler.java	2008-08-07 04:00:52 UTC (rev 76737)
@@ -25,8 +25,6 @@
 import java.io.Serializable;
 import java.lang.reflect.InvocationHandler;
 
-import org.jboss.ejb3.common.lang.SerializableMethod;
-
 /**
  * ProxyInvocationHandler
  * 
@@ -40,12 +38,4 @@
 public interface ProxyInvocationHandler extends InvocationHandler, Serializable
 {
    Object getAsynchronousProxy(Object proxy);
-
-   /**
-    * Obtain the method invoked upon the proxy
-    * 
-    * @return
-    */
-   SerializableMethod getInvokedMethod();
-
 }
\ No newline at end of file

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java	2008-08-07 04:00:19 UTC (rev 76736)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/ProxyInvocationHandlerBase.java	2008-08-07 04:00:52 UTC (rev 76737)
@@ -117,21 +117,18 @@
     * 
     * @param proxy
     * @param args Arguments of the current invocation
+    * @param invokedMethod The method invoked
     * @return
     * @throws NotEligibleForDirectInvocationException
     */
-   protected Object handleInvocationDirectly(Object proxy, Object[] args)
+   protected Object handleInvocationDirectly(Object proxy, Object[] args, Method invokedMethod)
          throws NotEligibleForDirectInvocationException
    {
       // Obtain the invoked method
-      SerializableMethod invokedMethod = this.getInvokedMethod();
       assert invokedMethod != null : "Invoked Method was not set upon invocation of " + this.getClass().getName();
 
-      // Obtain Declared Method
-      Method declaredMethod = invokedMethod.toMethod();
-
       // equals
-      if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_EQUALS.toMethod()))
+      if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_EQUALS.toMethod()))
       {
          assert args.length == 1 : "Invocation for 'equals' should have exactly one argument, instead was: "
                + invokedMethod;
@@ -139,18 +136,18 @@
          return this.invokeEquals(proxy, argument);
       }
       // toString
-      if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_TO_STRING.toMethod()))
+      if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_TO_STRING.toMethod()))
       {
          return this.toString();
       }
       // hashCode
-      if (declaredMethod.equals(ProxyInvocationHandlerBase.METHOD_HASH_CODE.toMethod()))
+      if (invokedMethod.equals(ProxyInvocationHandlerBase.METHOD_HASH_CODE.toMethod()))
       {
          return this.invokeHashCode(proxy);
       }
 
       // If no eligible methods were invoked
-      throw new NotEligibleForDirectInvocationException("Current invocation \"" + this.getInvokedMethod()
+      throw new NotEligibleForDirectInvocationException("Current invocation \"" + invokedMethod
             + "\" is not eligible for direct handling by " + this);
    }
 
@@ -179,16 +176,6 @@
    // Accessors / Mutators ---------------------------------------------------------||
    // ------------------------------------------------------------------------------||
 
-   public SerializableMethod getInvokedMethod()
-   {
-      return invokedMethod;
-   }
-
-   protected void setInvokedMethod(SerializableMethod invokedMethod)
-   {
-      this.invokedMethod = invokedMethod;
-   }
-
    protected String getContainerName()
    {
       return containerName;

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java	2008-08-07 04:00:19 UTC (rev 76736)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/handler/session/SessionSpecProxyInvocationHandlerBase.java	2008-08-07 04:00:52 UTC (rev 76737)
@@ -84,24 +84,23 @@
 
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
    {
-      // Obtain an explicitly-specified actual class
-      String actualClass = this.getBusinessInterfaceType();
-
-      // Set the invoked method
-      SerializableMethod invokedMethod = new SerializableMethod(method, actualClass);
-      this.setInvokedMethod(invokedMethod);
-
       // Attempt to handle directly
       try
       {
-         return this.handleInvocationDirectly(proxy, args);
+         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 an explicitly-specified actual class
+      String actualClass = this.getBusinessInterfaceType();
 
+      // Set the invoked method
+      SerializableMethod invokedMethod = new SerializableMethod(method, actualClass);
+
       /*
        * Obtain the Container
        */




More information about the jboss-cvs-commits mailing list