From: Christopher Yeoh <yeohc@au1.ibm.com>
Adding Oarfileloaded and EmptyScriptCompileQueue event support which allows (with a module) for programmatic notification of when a region objects and scripts are up and running after a server start or load-oar.
This commit is contained in:
@@ -71,6 +71,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
private ThreadPriority m_Prio;
|
||||
private bool m_Enabled = false;
|
||||
private bool m_InitialStartup = true;
|
||||
private int m_ScriptFailCount; // Number of script fails since compile queue was last empty
|
||||
private string m_ScriptErrorMessage;
|
||||
|
||||
// disable warning: need to keep a reference to XEngine.EventManager
|
||||
// alive to avoid it being garbage collected
|
||||
@@ -149,6 +151,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
public void Initialise(Scene scene, IConfigSource configSource)
|
||||
{
|
||||
m_ScriptConfig = configSource.Configs["XEngine"];
|
||||
m_ScriptFailCount = 0;
|
||||
m_ScriptErrorMessage = String.Empty;
|
||||
|
||||
if (m_ScriptConfig == null)
|
||||
{
|
||||
@@ -417,6 +421,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
{
|
||||
m_InitialStartup = false;
|
||||
System.Threading.Thread.Sleep(15000);
|
||||
lock (m_CompileQueue)
|
||||
{
|
||||
if (m_CompileQueue.Count==0)
|
||||
// No scripts on region, so won't get triggered later
|
||||
// by the queue becoming empty so we trigger it here
|
||||
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(0, String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
Object o;
|
||||
@@ -443,6 +454,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
else
|
||||
{
|
||||
m_CurrentCompile = null;
|
||||
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
|
||||
m_ScriptErrorMessage);
|
||||
m_ScriptFailCount = 0;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -468,12 +482,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
if (part == null)
|
||||
{
|
||||
Log.Error("[Script] SceneObjectPart unavailable. Script NOT started.");
|
||||
m_ScriptErrorMessage += "SceneObjectPart unavailable. Script NOT started.\n";
|
||||
m_ScriptFailCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID);
|
||||
if (item == null)
|
||||
{
|
||||
m_ScriptErrorMessage += "Can't find script inventory item.\n";
|
||||
m_ScriptFailCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
UUID assetID = item.AssetID;
|
||||
|
||||
@@ -499,6 +519,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
try
|
||||
{
|
||||
// DISPLAY ERROR INWORLD
|
||||
m_ScriptErrorMessage += "Failed to compile: " + e.Message.ToString();
|
||||
m_ScriptFailCount++;
|
||||
string text = "Error compiling script:\n" + e.Message.ToString();
|
||||
if (text.Length > 1000)
|
||||
text = text.Substring(0, 1000);
|
||||
@@ -567,6 +589,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[XEngine] Exception creating app domain:\n {0}", e.ToString());
|
||||
m_ScriptErrorMessage += "Exception creating app domain:\n";
|
||||
m_ScriptFailCount++;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user