aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs70
1 files changed, 51 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index cfcc36e..c237282 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -42,27 +42,28 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
42 /// </summary> 42 /// </summary>
43 /// 43 ///
44 [Serializable] 44 [Serializable]
45 public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine 45 public abstract class ScriptEngine : IRegionModule, OpenSim.Region.ScriptEngine.Common.ScriptServerInterfaces.ScriptEngine, iScriptEngineFunctionModule
46 { 46 {
47 public Scene World; 47 public Scene World;
48 public EventManager m_EventManager; // Handles and queues incoming events from OpenSim 48 public EventManager m_EventManager; // Handles and queues incoming events from OpenSim
49 public EventQueueManager m_EventQueueManager; // Executes events 49 public EventQueueManager m_EventQueueManager; // Executes events, handles script threads
50 public ScriptManager m_ScriptManager; // Load, unload and execute scripts 50 public ScriptManager m_ScriptManager; // Load, unload and execute scripts
51 public AppDomainManager m_AppDomainManager; 51 public AppDomainManager m_AppDomainManager; // Handles loading/unloading of scripts into AppDomains
52 public LSLLongCmdHandler m_LSLLongCmdHandler; 52 public AsyncLSLCommandManager m_ASYNCLSLCommandManager; // Asyncronous LSL commands (commands that returns with an event)
53 public MaintenanceThread m_MaintenanceThread; // Thread that does different kinds of maintenance, for example refreshing config and killing scripts that has been running too long
53 54
54 public IConfigSource ConfigSource; 55 public IConfigSource ConfigSource;
55 public IConfig ScriptConfigSource; 56 public IConfig ScriptConfigSource;
56 public abstract string ScriptConfigSourceName { get; } 57 public abstract string ScriptEngineName { get; }
57 58
58 /// <summary> 59 /// <summary>
59 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes. 60 /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes.
60 /// </summary> 61 /// </summary>
61 public int ReReadConfigFileSeconds { 62 public int RefreshConfigFileSeconds {
62 get { return (int)(ReReadConfigFilens / 10000); } 63 get { return (int)(RefreshConfigFilens / 10000); }
63 set { ReReadConfigFilens = value * 10000; } 64 set { RefreshConfigFilens = value * 10000; }
64 } 65 }
65 public long ReReadConfigFilens = 0; 66 public long RefreshConfigFilens = 0;
66 67
67 public ScriptManager GetScriptManager() 68 public ScriptManager GetScriptManager()
68 { 69 {
@@ -88,21 +89,22 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
88 { 89 {
89 World = Sceneworld; 90 World = Sceneworld;
90 m_log = logger; 91 m_log = logger;
91 ScriptConfigSource = ConfigSource.Configs[ScriptConfigSourceName]; 92 ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
92 93
93 Log.Verbose("ScriptEngine", "DotNet & LSL ScriptEngine initializing"); 94 Log.Verbose(ScriptEngineName, "DotNet & LSL ScriptEngine initializing");
94 95
95 //m_logger.Status("ScriptEngine", "InitializeEngine"); 96 //m_logger.Status(ScriptEngineName, "InitializeEngine");
96 97
97 // Create all objects we'll be using 98 // Create all objects we'll be using
98 m_EventQueueManager = new EventQueueManager(this); 99 m_EventQueueManager = new EventQueueManager(this);
99 m_EventManager = new EventManager(this, HookUpToServer); 100 m_EventManager = new EventManager(this, HookUpToServer);
100 m_ScriptManager = newScriptManager; 101 m_ScriptManager = newScriptManager;
101 //m_ScriptManager = new ScriptManager(this); 102 m_AppDomainManager = new AppDomainManager(this);
102 m_AppDomainManager = new AppDomainManager(ScriptConfigSource.GetInt("ScriptsPerAppDomain", 1)); 103 m_ASYNCLSLCommandManager = new AsyncLSLCommandManager(this);
103 m_LSLLongCmdHandler = new LSLLongCmdHandler(this); 104 m_MaintenanceThread = new MaintenanceThread(this);
105
106 ReadConfig();
104 107
105 ReReadConfigFileSeconds = ScriptConfigSource.GetInt("ReReadConfig", 0);
106 108
107 109
108 // Should we iterate the region for scripts that needs starting? 110 // Should we iterate the region for scripts that needs starting?
@@ -118,6 +120,26 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
118 { 120 {
119 return this.m_EventManager; 121 return this.m_EventManager;
120 } 122 }
123 public void ReadConfig()
124 {
125#if DEBUG
126 Log.Debug(ScriptEngineName, "Refreshing configuration for all modules");
127#endif
128 RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 0);
129
130 // Reload from disk
131 ConfigSource.Reload();
132 // Create a new object (probably not necessary?)
133// ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
134
135 if (m_EventQueueManager != null) m_EventQueueManager.ReadConfig();
136 if (m_EventManager != null) m_EventManager.ReadConfig();
137 if (m_ScriptManager != null) m_ScriptManager.ReadConfig();
138 if (m_AppDomainManager != null) m_AppDomainManager.ReadConfig();
139 if (m_ASYNCLSLCommandManager != null) m_ASYNCLSLCommandManager.ReadConfig();
140 if (m_MaintenanceThread != null) m_MaintenanceThread.ReadConfig();
141
142 }
121 143
122 144
123 #region IRegionModule 145 #region IRegionModule
@@ -134,7 +156,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
134 156
135 public string Name 157 public string Name
136 { 158 {
137 get { return "DotNetEngine"; } 159 get { return "Common." + ScriptEngineName; }
138 } 160 }
139 161
140 public bool IsSharedModule 162 public bool IsSharedModule
@@ -146,5 +168,15 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
146 168
147 #endregion 169 #endregion
148 170
171 /// <summary>
172 /// If set to true then threads and stuff should try to make a graceful exit
173 /// </summary>
174 public bool PleaseShutdown
175 {
176 get { return _PleaseShutdown; }
177 set { _PleaseShutdown = value; }
178 }
179 private bool _PleaseShutdown = false;
180
149 } 181 }
150} \ No newline at end of file 182} \ No newline at end of file