[seam-commits] Seam SVN: r7793 - in trunk/src/main/org/jboss/seam: core and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Apr 2 07:49:04 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-04-02 07:49:04 -0400 (Wed, 02 Apr 2008)
New Revision: 7793

Modified:
   trunk/src/main/org/jboss/seam/contexts/BasicContext.java
   trunk/src/main/org/jboss/seam/core/Events.java
Log:
Events made EVENT-scoped for improved performance

Modified: trunk/src/main/org/jboss/seam/contexts/BasicContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/contexts/BasicContext.java	2008-04-02 10:26:13 UTC (rev 7792)
+++ trunk/src/main/org/jboss/seam/contexts/BasicContext.java	2008-04-02 11:49:04 UTC (rev 7793)
@@ -7,6 +7,7 @@
 
 import org.jboss.seam.Component;
 import org.jboss.seam.ScopeType;
+import org.jboss.seam.Seam;
 import org.jboss.seam.core.Events;
 
 /**
@@ -76,7 +77,11 @@
 
    public void set(String name, Object value)
    {
-      if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
+      // We can't raise a preSetVariable event for Events itself because it doesn't exist yet...
+      if ( !Seam.getComponentName(Events.class).equals(name) && Events.exists() ) 
+      {
+         Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
+      }
       map.put(name, value);
       if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
    }

Modified: trunk/src/main/org/jboss/seam/core/Events.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Events.java	2008-04-02 10:26:13 UTC (rev 7792)
+++ trunk/src/main/org/jboss/seam/core/Events.java	2008-04-02 11:49:04 UTC (rev 7793)
@@ -28,7 +28,7 @@
  * @author Gavin King
  *
  */
- at Scope(ScopeType.STATELESS)
+ at Scope(ScopeType.EVENT)
 @BypassInterceptors
 @Name("org.jboss.seam.core.events")
 @Install(precedence=BUILT_IN)
@@ -149,12 +149,12 @@
    
    public static boolean exists()
    {
-      return Contexts.isApplicationContextActive() && instance()!=null;
+      return Contexts.isEventContextActive() && instance()!=null;
    }
 
    public static Events instance()
    {
-      return (Events) Component.getInstance(Events.class, ScopeType.STATELESS);
+      return (Events) Component.getInstance(Events.class, ScopeType.EVENT);
    }
    
 }




More information about the seam-commits mailing list