deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-1256 remove local ProjectStage cache from ConfigResolver
Date Wed, 17 May 2017 20:37:44 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 0cdede08c -> 301ff1b4e


DELTASPIKE-1256 remove local ProjectStage cache from ConfigResolver

After profiling and doing some performance tests it became clear that
the performance impact is really low. Probably because JIT optimises it anyway.
By going to ProjectStageProducer every time we can more easily invalidate a ProjectStage at
runtime.
This is especially important for unit testing scenarios.


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

Branch: refs/heads/master
Commit: 84f956f6663c3604af0f0d07d2cfb2b8d857eafd
Parents: 0cdede0
Author: Mark Struberg <struberg@apache.org>
Authored: Wed May 17 22:29:06 2017 +0200
Committer: Mark Struberg <struberg@apache.org>
Committed: Wed May 17 22:29:06 2017 +0200

----------------------------------------------------------------------
 .../deltaspike/core/api/config/ConfigResolver.java   | 11 +----------
 .../test/testcontrol/uc013/ContainerConfigTest.java  | 15 ---------------
 2 files changed, 1 insertion(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/84f956f6/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
index f8bcae7..3961678 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
@@ -92,7 +92,6 @@ public final class ConfigResolver
     private static Map<ClassLoader, List<ConfigFilter>> configFilters
         = new ConcurrentHashMap<ClassLoader, List<ConfigFilter>>();
 
-    private static volatile ProjectStage projectStage = null;
 
     private ConfigResolver()
     {
@@ -565,15 +564,7 @@ public final class ConfigResolver
 
     private static ProjectStage getProjectStage()
     {
-        if (projectStage == null)
-        {
-            synchronized (ConfigResolver.class)
-            {
-                projectStage = ProjectStageProducer.getInstance().getProjectStage();
-            }
-        }
-
-        return projectStage;
+        return ProjectStageProducer.getInstance().getProjectStage();
     }
 
     private static <T> T fallbackToDefaultIfEmpty(String key, T value, T defaultValue)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/84f956f6/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java
b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java
index df8a4f7..6f5241f 100644
--- a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java
+++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc013/ContainerConfigTest.java
@@ -41,21 +41,6 @@ import java.lang.reflect.Field;
 @RunWith(CdiTestRunner.class)
 public class ContainerConfigTest
 {
-    @Before
-    public void resetConfig()
-    {
-        //TODO discuss an api to reset the ConfigResolver
-        try
-        {
-            Field projectStageField = ConfigResolver.class.getDeclaredField("projectStage");
-            projectStageField.setAccessible(true);
-            projectStageField.set(null, null);
-        }
-        catch (Exception e)
-        {
-            throw ExceptionUtils.throwAsRuntimeException(e);
-        }
-    }
 
     @Test
     @TestControl(projectStage = ProjectStage.UnitTest.class) //just for internal tests


Mime
View raw message