diff options
author | Justin Clark-Casey (justincc) | 2011-11-17 21:03:08 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-17 21:03:08 +0000 |
commit | cacc02883526d6913be13d745215d7367708412e (patch) | |
tree | dd06d0f6f8a296f6274c9f946ad7a3f108cfa73d /OpenSim | |
parent | Stop OdePrim and OdeCharacter insanely overriding set LocalID to set their ow... (diff) | |
download | opensim-SC-cacc02883526d6913be13d745215d7367708412e.zip opensim-SC-cacc02883526d6913be13d745215d7367708412e.tar.gz opensim-SC-cacc02883526d6913be13d745215d7367708412e.tar.bz2 opensim-SC-cacc02883526d6913be13d745215d7367708412e.tar.xz |
If the entire simulator is shutting down then don't bother to unload the scripts from the appdomain in XEngine.
All the other actions (script state save, etc.) still occur.
This makes shutdown where there are many scripts vastly quicker.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 26 |
2 files changed, 35 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4906665..4a4d98f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -98,9 +98,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
98 | 98 | ||
99 | public event OnPluginConsoleDelegate OnPluginConsole; | 99 | public event OnPluginConsoleDelegate OnPluginConsole; |
100 | 100 | ||
101 | public delegate void OnShutdownDelegate(); | 101 | /// <summary> |
102 | 102 | /// Triggered when the entire simulator is shutdown. | |
103 | public event OnShutdownDelegate OnShutdown; | 103 | /// </summary> |
104 | public event Action OnShutdown; | ||
104 | 105 | ||
105 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); | 106 | public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); |
106 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); | 107 | public delegate void ScriptResetDelegate(uint localID, UUID itemID); |
@@ -113,9 +114,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | 114 | ||
114 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 115 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
115 | 116 | ||
116 | public delegate void SceneShuttingDownDelegate(Scene scene); | 117 | /// <summary> |
117 | 118 | /// Triggered when an individual scene is shutdown. | |
118 | public event SceneShuttingDownDelegate OnSceneShuttingDown; | 119 | /// </summary> |
120 | /// <remarks> | ||
121 | /// This does not automatically mean that the entire simulator is shutting down. Listen to OnShutdown for that | ||
122 | /// notification. | ||
123 | /// </remarks> | ||
124 | public event Action<Scene> OnSceneShuttingDown; | ||
119 | 125 | ||
120 | /// <summary> | 126 | /// <summary> |
121 | /// Fired when an object is touched/grabbed. | 127 | /// Fired when an object is touched/grabbed. |
@@ -869,10 +875,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
869 | 875 | ||
870 | public void TriggerShutdown() | 876 | public void TriggerShutdown() |
871 | { | 877 | { |
872 | OnShutdownDelegate handlerShutdown = OnShutdown; | 878 | Action handlerShutdown = OnShutdown; |
873 | if (handlerShutdown != null) | 879 | if (handlerShutdown != null) |
874 | { | 880 | { |
875 | foreach (OnShutdownDelegate d in handlerShutdown.GetInvocationList()) | 881 | foreach (Action d in handlerShutdown.GetInvocationList()) |
876 | { | 882 | { |
877 | try | 883 | try |
878 | { | 884 | { |
@@ -2212,10 +2218,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2212 | 2218 | ||
2213 | public void TriggerSceneShuttingDown(Scene s) | 2219 | public void TriggerSceneShuttingDown(Scene s) |
2214 | { | 2220 | { |
2215 | SceneShuttingDownDelegate handler = OnSceneShuttingDown; | 2221 | Action<Scene> handler = OnSceneShuttingDown; |
2216 | if (handler != null) | 2222 | if (handler != null) |
2217 | { | 2223 | { |
2218 | foreach (SceneShuttingDownDelegate d in handler.GetInvocationList()) | 2224 | foreach (Action<Scene> d in handler.GetInvocationList()) |
2219 | { | 2225 | { |
2220 | try | 2226 | try |
2221 | { | 2227 | { |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 1c16c87..12e1a78 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -90,6 +90,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
90 | private bool m_KillTimedOutScripts; | 90 | private bool m_KillTimedOutScripts; |
91 | private string m_ScriptEnginesPath = null; | 91 | private string m_ScriptEnginesPath = null; |
92 | 92 | ||
93 | /// <summary> | ||
94 | /// Is the entire simulator in the process of shutting down? | ||
95 | /// </summary> | ||
96 | private bool m_SimulatorShuttingDown; | ||
97 | |||
93 | private static List<XEngine> m_ScriptEngines = | 98 | private static List<XEngine> m_ScriptEngines = |
94 | new List<XEngine>(); | 99 | new List<XEngine>(); |
95 | 100 | ||
@@ -470,17 +475,22 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
470 | // | 475 | // |
471 | instance.DestroyScriptInstance(); | 476 | instance.DestroyScriptInstance(); |
472 | 477 | ||
473 | // Unload scripts and app domains | 478 | // Unload scripts and app domains. |
474 | // Must be done explicitly because they have infinite | 479 | // Must be done explicitly because they have infinite |
475 | // lifetime | 480 | // lifetime. |
476 | // | 481 | // However, don't bother to do this if the simulator is shutting |
477 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); | 482 | // down since it takes a long time with many scripts. |
478 | if (m_DomainScripts[instance.AppDomain].Count == 0) | 483 | if (!m_SimulatorShuttingDown) |
479 | { | 484 | { |
480 | m_DomainScripts.Remove(instance.AppDomain); | 485 | m_DomainScripts[instance.AppDomain].Remove(instance.ItemID); |
481 | UnloadAppDomain(instance.AppDomain); | 486 | if (m_DomainScripts[instance.AppDomain].Count == 0) |
487 | { | ||
488 | m_DomainScripts.Remove(instance.AppDomain); | ||
489 | UnloadAppDomain(instance.AppDomain); | ||
490 | } | ||
482 | } | 491 | } |
483 | } | 492 | } |
493 | |||
484 | m_Scripts.Clear(); | 494 | m_Scripts.Clear(); |
485 | m_PrimObjects.Clear(); | 495 | m_PrimObjects.Clear(); |
486 | m_Assemblies.Clear(); | 496 | m_Assemblies.Clear(); |
@@ -1428,6 +1438,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1428 | 1438 | ||
1429 | public void OnShutdown() | 1439 | public void OnShutdown() |
1430 | { | 1440 | { |
1441 | m_SimulatorShuttingDown = true; | ||
1442 | |||
1431 | List<IScriptInstance> instances = new List<IScriptInstance>(); | 1443 | List<IScriptInstance> instances = new List<IScriptInstance>(); |
1432 | 1444 | ||
1433 | lock (m_Scripts) | 1445 | lock (m_Scripts) |