aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
diff options
context:
space:
mode:
authorTedd Hansen2007-09-13 11:11:08 +0000
committerTedd Hansen2007-09-13 11:11:08 +0000
commitcef8c5e9d7ce49cc47e7ef1816465064d889d6d5 (patch)
treeeb50e06403d1270b5eb6ce1456e2c9d44b3c6488 /OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
parentBackup is now optional on classes (diff)
downloadopensim-SC-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.zip
opensim-SC-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.gz
opensim-SC-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.bz2
opensim-SC-cef8c5e9d7ce49cc47e7ef1816465064d889d6d5.tar.xz
Hiding evidence that I once was a VB coder (thanks to refactoring). Renamed member names to smallcapsy.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs44
1 files changed, 22 insertions, 22 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 14343b1..96670f1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -15,11 +15,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
15{ 15{
16 public class AppDomainManager 16 public class AppDomainManager
17 { 17 {
18 private int MaxScriptsPerAppDomain = 1; 18 private int maxScriptsPerAppDomain = 1;
19 /// <summary> 19 /// <summary>
20 /// Internal list of all AppDomains 20 /// Internal list of all AppDomains
21 /// </summary> 21 /// </summary>
22 private List<AppDomainStructure> AppDomains = new List<AppDomainStructure>(); 22 private List<AppDomainStructure> appDomains = new List<AppDomainStructure>();
23 /// <summary> 23 /// <summary>
24 /// Structure to keep track of data around AppDomain 24 /// Structure to keep track of data around AppDomain
25 /// </summary> 25 /// </summary>
@@ -41,9 +41,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
41 /// <summary> 41 /// <summary>
42 /// Current AppDomain 42 /// Current AppDomain
43 /// </summary> 43 /// </summary>
44 private AppDomainStructure CurrentAD; 44 private AppDomainStructure currentAD;
45 private object GetLock = new object(); // Mutex 45 private object getLock = new object(); // Mutex
46 private object FreeLock = new object(); // Mutex 46 private object freeLock = new object(); // Mutex
47 47
48 //private ScriptEngine m_scriptEngine; 48 //private ScriptEngine m_scriptEngine;
49 //public AppDomainManager(ScriptEngine scriptEngine) 49 //public AppDomainManager(ScriptEngine scriptEngine)
@@ -59,25 +59,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
59 private AppDomainStructure GetFreeAppDomain() 59 private AppDomainStructure GetFreeAppDomain()
60 { 60 {
61 Console.WriteLine("Finding free AppDomain"); 61 Console.WriteLine("Finding free AppDomain");
62 lock (GetLock) 62 lock (getLock)
63 { 63 {
64 // Current full? 64 // Current full?
65 if (CurrentAD != null && CurrentAD.ScriptsLoaded >= MaxScriptsPerAppDomain) 65 if (currentAD != null && currentAD.ScriptsLoaded >= maxScriptsPerAppDomain)
66 { 66 {
67 // Add it to AppDomains list and empty current 67 // Add it to AppDomains list and empty current
68 AppDomains.Add(CurrentAD); 68 appDomains.Add(currentAD);
69 CurrentAD = null; 69 currentAD = null;
70 } 70 }
71 // No current 71 // No current
72 if (CurrentAD == null) 72 if (currentAD == null)
73 { 73 {
74 // Create a new current AppDomain 74 // Create a new current AppDomain
75 CurrentAD = new AppDomainStructure(); 75 currentAD = new AppDomainStructure();
76 CurrentAD.CurrentAppDomain = PrepareNewAppDomain(); 76 currentAD.CurrentAppDomain = PrepareNewAppDomain();
77 } 77 }
78 78
79 Console.WriteLine("Scripts loaded in this Appdomain: " + CurrentAD.ScriptsLoaded); 79 Console.WriteLine("Scripts loaded in this Appdomain: " + currentAD.ScriptsLoaded);
80 return CurrentAD; 80 return currentAD;
81 } // lock 81 } // lock
82 } 82 }
83 83
@@ -112,13 +112,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
112 /// </summary> 112 /// </summary>
113 private void UnloadAppDomains() 113 private void UnloadAppDomains()
114 { 114 {
115 lock (FreeLock) 115 lock (freeLock)
116 { 116 {
117 // Go through all 117 // Go through all
118 foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) 118 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
119 { 119 {
120 // Don't process current AppDomain 120 // Don't process current AppDomain
121 if (ads.CurrentAppDomain != CurrentAD.CurrentAppDomain) 121 if (ads.CurrentAppDomain != currentAD.CurrentAppDomain)
122 { 122 {
123 // Not current AppDomain 123 // Not current AppDomain
124 // Is number of unloaded bigger or equal to number of loaded? 124 // Is number of unloaded bigger or equal to number of loaded?
@@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
126 { 126 {
127 Console.WriteLine("Found empty AppDomain, unloading"); 127 Console.WriteLine("Found empty AppDomain, unloading");
128 // Remove from internal list 128 // Remove from internal list
129 AppDomains.Remove(ads); 129 appDomains.Remove(ads);
130#if DEBUG 130#if DEBUG
131 long m = GC.GetTotalMemory(true); 131 long m = GC.GetTotalMemory(true);
132#endif 132#endif
@@ -164,19 +164,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
164 //[Obsolete("Needs fixing, needs a real purpose in life!!!")] 164 //[Obsolete("Needs fixing, needs a real purpose in life!!!")]
165 public void StopScript(AppDomain ad) 165 public void StopScript(AppDomain ad)
166 { 166 {
167 lock (FreeLock) 167 lock (freeLock)
168 { 168 {
169 Console.WriteLine("Stopping script in AppDomain"); 169 Console.WriteLine("Stopping script in AppDomain");
170 // Check if it is current AppDomain 170 // Check if it is current AppDomain
171 if (CurrentAD.CurrentAppDomain == ad) 171 if (currentAD.CurrentAppDomain == ad)
172 { 172 {
173 // Yes - increase 173 // Yes - increase
174 CurrentAD.ScriptsWaitingUnload++; 174 currentAD.ScriptsWaitingUnload++;
175 return; 175 return;
176 } 176 }
177 177
178 // Lopp through all AppDomains 178 // Lopp through all AppDomains
179 foreach (AppDomainStructure ads in new System.Collections.ArrayList(AppDomains)) 179 foreach (AppDomainStructure ads in new System.Collections.ArrayList(appDomains))
180 { 180 {
181 if (ads.CurrentAppDomain == ad) 181 if (ads.CurrentAppDomain == ad)
182 { 182 {