deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject deltaspike git commit: DELTASPIKE-772 delegation moved after the jndi-lookup
Date Sat, 08 Nov 2014 21:32:46 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master b386236d9 -> 5ee1c46f9


DELTASPIKE-772 delegation moved after the jndi-lookup


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

Branch: refs/heads/master
Commit: 5ee1c46f99e09bc19149d12d0b3bab3c499abe40
Parents: b386236
Author: gpetracek <gpetracek@apache.org>
Authored: Sat Nov 8 22:31:10 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Sat Nov 8 22:31:10 2014 +0100

----------------------------------------------------------------------
 .../core/api/provider/BeanManagerProvider.java   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/5ee1c46f/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
index d3b4b7f..692beab 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/provider/BeanManagerProvider.java
@@ -78,7 +78,7 @@ public class BeanManagerProvider implements Extension
         //only init methods if a cdi 1.1+ container is available and the delegation-mode
isn't deactivated.
         //deactivation is e.g. useful if owb is used in "parallel mode" in a weld-based server.
         if (cdiClass != null && !"false".equalsIgnoreCase(
-            ConfigResolver.getPropertyValue("deltaspike.bean-manager.delegate_to_container",
Boolean.FALSE.toString())))
+            ConfigResolver.getPropertyValue("deltaspike.bean-manager.delegate_to_container",
Boolean.TRUE.toString())))
         {
 
             try
@@ -197,13 +197,6 @@ public class BeanManagerProvider implements Extension
      */
     public BeanManager getBeanManager()
     {
-        BeanManager result = resolveBeanManagerViaStaticHelper();
-
-        if (result != null)
-        {
-            return result;
-        }
-
         BeanManagerInfo bmi = getBeanManagerInfo(ClassUtils.getClassLoader(null));
 
         // warn the user if he tries to use the BeanManager before container startup
@@ -220,7 +213,7 @@ public class BeanManagerProvider implements Extension
             }
         }
 
-        result = bmi.finalBm;
+        BeanManager result = bmi.finalBm;
 
         if (result == null)
         {
@@ -232,6 +225,14 @@ public class BeanManagerProvider implements Extension
                     // first we look for a BeanManager from JNDI
                     result = resolveBeanManagerViaJndi();
 
+                    // needs to be here to get a better performance and
+                    // even in ee7 containers we can't rely on that lookup as a primary strategy
+                    // (esp. in case of EAR based applications)
+                    if (result == null)
+                    {
+                        result = resolveBeanManagerViaStaticHelper();
+                    }
+
                     if (result == null)
                     {
                         // if none found, we take the one we got from the Extension loading


Mime
View raw message