You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/07/13 19:58:53 UTC
git commit: DELTASPIKE-237 cleanup ConfigResolver Map on shutdown
Updated Branches:
refs/heads/master 78b37a9c7 -> 9c605a8a4
DELTASPIKE-237 cleanup ConfigResolver Map on shutdown
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/9c605a8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/9c605a8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/9c605a8a
Branch: refs/heads/master
Commit: 9c605a8a4b61fe3110b3e3f0083d3a79cd464573
Parents: 78b37a9
Author: Mark Struberg <st...@apache.org>
Authored: Fri Jul 13 19:57:54 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Fri Jul 13 19:57:54 2012 +0200
----------------------------------------------------------------------
.../deltaspike/core/api/config/ConfigResolver.java | 8 ++++++++
.../core/impl/config/ConfigurationExtension.java | 10 ++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9c605a8a/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 d72ca69..ff553a8 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
@@ -86,6 +86,14 @@ public final class ConfigResolver
}
/**
+ * Clear all ConfigSources for the current ClassLoader
+ */
+ public static synchronized void freeConfigSources()
+ {
+ configSources.remove(ClassUtils.getClassLoader(null));
+ }
+
+ /**
* Resolve the property value by going through the list of configured {@link ConfigSource}s
* and use the one with the highest priority. If no configured value has been found that
* way we will use the defaultValue.
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/9c605a8a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java
index 0b9698a..740473d 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigurationExtension.java
@@ -21,6 +21,7 @@ package org.apache.deltaspike.core.impl.config;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
@@ -93,6 +94,15 @@ public class ConfigurationExtension implements Extension, Deactivatable
}
/**
+ * This method triggers freeing of the ConfigSources.
+ */
+ @SuppressWarnings("UnusedDeclaration")
+ public void freeConfigSources(@Observes BeforeShutdown bs)
+ {
+ ConfigResolver.freeConfigSources();
+ }
+
+ /**
* @return create an instance of the given PropertyConfigSource and return all it's ConfigSources.
*/
private List<ConfigSource> createPropertyConfigSource(Class<? extends PropertyConfigSource> configSourcesClass)