openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1477289 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event: EventUtil.java NotificationManager.java
Date Mon, 29 Apr 2013 19:30:39 GMT
Author: gpetracek
Date: Mon Apr 29 19:30:34 2013
New Revision: 1477289

URL: http://svn.apache.org/r1477289
Log:
OWB-798 first performance improvement

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=1477289&r1=1477288&r2=1477289&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
Mon Apr 29 19:30:34 2013
@@ -54,20 +54,23 @@ public final class EventUtil
         }
     }
 
-    public static void checkEventBindings(WebBeansContext webBeansContext, Set<Annotation>
annotations)
+    //expensive check needed by the TCK (EventBindingTypesTest#testFireEventWithNonRuntimeBindingTypeFails)
- see OWB-798
+    public static void checkQualifierImplementations(Set<Annotation> qualifiers)
     {
-        for(Annotation ann : annotations)
+        for (Annotation qualifier : qualifiers)
         {
             //This is added, because TCK Event tests for this.
-            Retention retention = ann.annotationType().getAnnotation(Retention.class);
+            Retention retention = qualifier.annotationType().getAnnotation(Retention.class);
             RetentionPolicy policy = retention.value();
             if(!policy.equals(RetentionPolicy.RUNTIME))
             {
-                throw new IllegalArgumentException("Event qualifiere RetentionPolicy must
be RUNTIME for qualifier : " + ann);
+                throw new IllegalArgumentException("Event qualifier RetentionPolicy must
be RUNTIME for qualifier : " + qualifier.annotationType().getName());
             }
-            ///////////////////////////////////////////////////////
-
         }
+    }
+
+    public static void checkEventBindings(WebBeansContext webBeansContext, Set<Annotation>
annotations)
+    {
         webBeansContext.getAnnotationManager().checkQualifierConditions(annotations);
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1477289&r1=1477288&r2=1477289&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
Mon Apr 29 19:30:34 2013
@@ -129,6 +129,12 @@ public final class NotificationManager
 
         observersMethods = filterByQualifiers(observersMethods, metadata.getQualifiers());
 
+        //this check for the TCK is only needed if no observer was found
+        if (observersMethods.isEmpty())
+        {
+            EventUtil.checkQualifierImplementations(metadata.getQualifiers());
+        }
+
         return observersMethods;
     }
 



Mime
View raw message