aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
index 2ed0529..0fb8d75 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AppDomainManager.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29
30using System; 29using System;
31using System.Collections; 30using System.Collections;
32using System.Collections.Generic; 31using System.Collections.Generic;
@@ -37,7 +36,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
37{ 36{
38 public class AppDomainManager : iScriptEngineFunctionModule 37 public class AppDomainManager : iScriptEngineFunctionModule
39 { 38 {
40
41 // 39 //
42 // This class does AppDomain handling and loading/unloading of scripts in it. 40 // This class does AppDomain handling and loading/unloading of scripts in it.
43 // It is instanced in "ScriptEngine" and controlled from "ScriptManager" 41 // It is instanced in "ScriptEngine" and controlled from "ScriptManager"
@@ -48,7 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
48 // 4. Unload AppDomain completely when all scripts in it has stopped 46 // 4. Unload AppDomain completely when all scripts in it has stopped
49 // 47 //
50 48
51
52 private int maxScriptsPerAppDomain = 1; 49 private int maxScriptsPerAppDomain = 1;
53 50
54 /// <summary> 51 /// <summary>
@@ -149,8 +146,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
149 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; 146 ads.ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
150 147
151 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads); 148 AppDomain AD = AppDomain.CreateDomain("ScriptAppDomain_" + AppDomainNameCount, null, ads);
152 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain Loading: " + 149 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain Loading: " +
153 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString()); 150 AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll").ToString());
154 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll")); 151 AD.Load(AssemblyName.GetAssemblyName("OpenSim.Region.ScriptEngine.Common.dll"));
155 152
156 // Return the new AppDomain 153 // Return the new AppDomain
@@ -183,7 +180,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
183 // Unload 180 // Unload
184 AppDomain.Unload(ads.CurrentAppDomain); 181 AppDomain.Unload(ads.CurrentAppDomain);
185#if DEBUG 182#if DEBUG
186 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory"); 183 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: AppDomain unload freed " + (m - GC.GetTotalMemory(true)) + " bytes of memory");
187#endif 184#endif
188 } 185 }
189 } 186 }
@@ -191,14 +188,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
191 } // lock 188 } // lock
192 } 189 }
193 190
194
195 public IScript LoadScript(string FileName) 191 public IScript LoadScript(string FileName)
196 { 192 {
197 // Find next available AppDomain to put it in 193 // Find next available AppDomain to put it in
198 AppDomainStructure FreeAppDomain = GetFreeAppDomain(); 194 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
199 195
200#if DEBUG 196#if DEBUG
201 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Loading into AppDomain: " + FileName); 197 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Loading into AppDomain: " + FileName);
202#endif 198#endif
203 IScript mbrt = 199 IScript mbrt =
204 (IScript) 200 (IScript)
@@ -220,7 +216,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
220 lock (freeLock) 216 lock (freeLock)
221 { 217 {
222#if DEBUG 218#if DEBUG
223 m_scriptEngine.Log.Verbose(m_scriptEngine.ScriptEngineName, "Stopping script in AppDomain"); 219 m_scriptEngine.Log.Info("[" + m_scriptEngine.ScriptEngineName + "]: Stopping script in AppDomain");
224#endif 220#endif
225 // Check if it is current AppDomain 221 // Check if it is current AppDomain
226 if (currentAD.CurrentAppDomain == ad) 222 if (currentAD.CurrentAppDomain == ad)
@@ -244,6 +240,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
244 240
245 UnloadAppDomains(); // Outsite lock, has its own GetLock 241 UnloadAppDomains(); // Outsite lock, has its own GetLock
246 } 242 }
243
247 /// <summary> 244 /// <summary>
248 /// If set to true then threads and stuff should try to make a graceful exit 245 /// If set to true then threads and stuff should try to make a graceful exit
249 /// </summary> 246 /// </summary>
@@ -253,6 +250,5 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
253 set { _PleaseShutdown = value; } 250 set { _PleaseShutdown = value; }
254 } 251 }
255 private bool _PleaseShutdown = false; 252 private bool _PleaseShutdown = false;
256
257 } 253 }
258} \ No newline at end of file 254}