geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r770885 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
Date Sat, 02 May 2009 02:42:29 GMT
Author: gawor
Date: Sat May  2 02:42:29 2009
New Revision: 770885

URL: http://svn.apache.org/viewvc?rev=770885&view=rev
Log:
invoke all register/unregister methods that match

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java?rev=770885&r1=770884&r2=770885&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/ServiceRegistrationProxy.java
Sat May  2 02:42:29 2009
@@ -168,8 +168,8 @@
         private Object listener;
         private RegistrationListener metadata;
         
-        private Method registerMethod;
-        private Method unregisterMethod;
+        private List<Method> registerMethods;
+        private List<Method> unregisterMethods;
         private boolean initialized = false;
         
         private synchronized void init(ServiceRegistrationProxy registration) {
@@ -182,10 +182,10 @@
             Class listenerClass = listener.getClass();
             
             if (metadata.getRegistrationMethodName() != null) { 
-                registerMethod = ReflectionUtils.findMethod(listenerClass, metadata.getRegistrationMethodName(),
paramTypes);
+                registerMethods = ReflectionUtils.findCompatibleMethods(listenerClass, metadata.getRegistrationMethodName(),
paramTypes);
             }
             if (metadata.getUnregistrationMethodName() != null) {
-                unregisterMethod = ReflectionUtils.findMethod(listenerClass, metadata.getUnregistrationMethodName(),
paramTypes);
+                unregisterMethods = ReflectionUtils.findCompatibleMethods(listenerClass,
metadata.getUnregistrationMethodName(), paramTypes);
             }
             
             initialized = true;
@@ -193,24 +193,26 @@
         
         public void register(ServiceRegistrationProxy registration) {
             init(registration);
-            invokeMethod(registerMethod, registration);
+            invokeMethod(registerMethods, registration);
         }
         
         public void unregister(ServiceRegistrationProxy registration) {
-            invokeMethod(unregisterMethod, registration);
+            invokeMethod(unregisterMethods, registration);
         }
                 
-        private void invokeMethod(Method method, ServiceRegistrationProxy registration) {
-            if (method == null) {
+        private void invokeMethod(List<Method> methods, ServiceRegistrationProxy registration)
{
+            if (methods == null || methods.isEmpty()) {
                 return;
             }
             Object service = registration.getService();
             Map properties = registration.getRegistrationProperties();
             Object[] args = new Object[] { service, properties };
-            try {
-                method.invoke(listener, args);
-            } catch (Exception e) {
-                LOGGER.info("Error calling listener", e);
+            for (Method method : methods) {
+                try {
+                    method.invoke(listener, args);
+                } catch (Exception e) {
+                    LOGGER.info("Error calling listener", e);
+                }
             }
         }
                            



Mime
View raw message