deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject git commit: DELTASPIKE-532 DeltaSpikeFacesContextFactory construction issue in non EE
Date Mon, 03 Mar 2014 18:11:33 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master e5160ee16 -> f24f10b3f


DELTASPIKE-532 DeltaSpikeFacesContextFactory construction issue in non EE 

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/f24f10b3
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/f24f10b3
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/f24f10b3

Branch: refs/heads/master
Commit: f24f10b3ff19a1d8eb9c421b9ec0ec3e8fbe60c1
Parents: e5160ee
Author: tandraschko <tandraschko@apache.org>
Authored: Mon Mar 3 19:11:24 2014 +0100
Committer: tandraschko <tandraschko@apache.org>
Committed: Mon Mar 3 19:11:24 2014 +0100

----------------------------------------------------------------------
 .../request/DeltaSpikeFacesContextFactory.java  | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f24f10b3/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
index 8295c5d..dafe21a 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/listener/request/DeltaSpikeFacesContextFactory.java
@@ -32,8 +32,10 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory
implement
     private final FacesContextFactory wrappedFacesContextFactory;
 
     private final boolean deactivated;
-
-    private final ClientWindow clientWindow;
+    
+    private volatile Boolean initialized;
+    
+    private ClientWindow clientWindow;
 
     /**
      * Constructor for wrapping the given {@link FacesContextFactory}
@@ -44,7 +46,6 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
     {
         this.wrappedFacesContextFactory = wrappedFacesContextFactory;
         this.deactivated = !ClassDeactivationUtils.isActivated(getClass());
-        this.clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true);
     }
 
     /**
@@ -66,6 +67,8 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory implement
             return facesContext;
         }
 
+        lazyInit();
+        
         return new DeltaSpikeFacesContextWrapper(facesContext, clientWindow);
     }
 
@@ -77,4 +80,23 @@ public class DeltaSpikeFacesContextFactory extends FacesContextFactory
implement
     {
         return wrappedFacesContextFactory;
     }
+    
+    private void lazyInit()
+    {
+        if (this.initialized == null)
+        {
+            init();
+        }
+    }
+
+    private synchronized void init()
+    {
+        // switch into paranoia mode
+        if (this.initialized == null)
+        {
+            this.clientWindow = BeanProvider.getContextualReference(ClientWindow.class, true);
+            
+            this.initialized = true;
+        }
+    }
 }
\ No newline at end of file


Mime
View raw message