[jboss-cvs] JBossAS SVN: r78472 - trunk/ejb3/src/main/org/jboss/ejb3/client.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 11 20:20:36 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-09-11 20:20:34 -0400 (Thu, 11 Sep 2008)
New Revision: 78472

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
Log:
JBCTS-843, use the metadata callbacks ordering to obtain the callback method list to invoke.

Modified: trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java	2008-09-11 23:52:51 UTC (rev 78471)
+++ trunk/ejb3/src/main/org/jboss/ejb3/client/ClientContainer.java	2008-09-12 00:20:34 UTC (rev 78472)
@@ -383,53 +383,8 @@
       LifecycleCallbacksMetaData callbacks = xml.getPostConstructs();
       if(callbacks == null || callbacks.isEmpty())
          return;
-      
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      Class<?> parameterTypes[] = new Class[0];
 
-      Set<Class<?>> callbacksSet = new HashSet<Class<?>>();
-      LinkedList<Method> methods = new LinkedList<Method>();
-
-      for (LifecycleCallbackMetaData callback : callbacks)
-      {
-         String className = callback.getClassName();
-         String methodName = callback.getMethodName();
-         Class<?> lifecycleClass = className == null ? mainClass : cl.loadClass(className);
-
-         // If we haven't yet added the callback for this class
-         if (callbacksSet.add(lifecycleClass))
-         {
-            Method method = lifecycleClass.getDeclaredMethod(methodName, parameterTypes);
-
-            boolean added = false;
-            for (int i = 0; i < methods.size(); ++i)
-            {
-               Method m = methods.get(i);
-               Class<?> methodClass = m.getDeclaringClass();
-               // insert the class before the current class in the list if the class is a superclass of the current class
-               if (lifecycleClass.isAssignableFrom(methodClass))
-               {
-                  methods.add(i, method);
-                  added = true;
-                  break;
-               }
-               // insert the class before the current class in the list
-               // if the class is not a subclass of the current class and
-               // it is a superclass of the default class or the default class itself 
-               else if(!methodClass.isAssignableFrom(lifecycleClass) &&
-                     (lifecycleClass == mainClass || lifecycleClass.isAssignableFrom(mainClass)))
-               {
-                  methods.add(i, method);
-                  added = true;
-                  break;
-               }
-            }
-            
-            if (!added)
-               methods.add(method);
-         }         
-      }
-      
+      List<Method> methods = callbacks.getOrderedCallbacks(mainClass);
       postConstructs.addAll(methods);
    }
 




More information about the jboss-cvs-commits mailing list