Author: kostat
Date: 2008-02-07 08:41:27 -0500 (Thu, 07 Feb 2008)
New Revision: 95139

Modified:
   
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs
Log:
TARGET_JVM: cache the merged AppSettings inside AppDomain

Modified: 
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs
  2008-02-07 13:35:13 UTC (rev 95138)
+++ 
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs
  2008-02-07 13:41:27 UTC (rev 95139)
@@ -48,7 +48,7 @@
                static IInternalConfigConfigurationFactory configFactory;
                static Hashtable configurations = Hashtable.Synchronized (new 
Hashtable ());
 #else
-               static readonly object AppSettingsKey = new object ();
+               const string AppSettingsKey = 
"WebConfigurationManager.AppSettings";
                static internal IInternalConfigConfigurationFactory 
configFactory
                {
                        get{
@@ -275,12 +275,18 @@
 #if TARGET_J2EE
                        object value = get_runtime_object.Invoke (section, new 
object [0]);
                        if (String.CompareOrdinal ("appSettings", sectionName) 
== 0) {
-                               HttpContext hc = HttpContext.Current;
-                               NameValueCollection collection = 
(NameValueCollection) hc.Items [AppSettingsKey];
+                               AppDomain appDomain = AppDomain.CurrentDomain;
+                               Hashtable settingsCache = (Hashtable) 
appDomain.GetData (AppSettingsKey);
+                               if (settingsCache == null) {
+                                       settingsCache = Hashtable.Synchronized 
(new Hashtable ());
+                                       appDomain.SetData (AppSettingsKey, 
settingsCache);
+                               }
 
+                               NameValueCollection collection = 
(NameValueCollection) settingsCache [c];
+
                                if (collection == null) {
-                                       collection = new 
KeyValueMergedCollection (hc, (NameValueCollection) value);
-                                       hc.Items [AppSettingsKey] = collection;
+                                       collection = new 
KeyValueMergedCollection (HttpContext.Current, (NameValueCollection) value);
+                                       settingsCache [c] = collection;
                                }
 
                                value = collection;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to