Updates all IRegionModules to the new style region modules.

Signed-off-by: Melanie <melanie@t-data.com>
This commit is contained in:
Revolution
2010-01-22 18:09:33 -06:00
committed by Melanie
parent e61f42ad3a
commit ec3c31e61e
76 changed files with 1899 additions and 954 deletions

View File

@@ -32,6 +32,7 @@ using System.Net;
using System.Reflection;
using System.Threading;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.Packets;
@@ -52,11 +53,13 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
public OSDMap body;
}
public class EventQueueGetModule : IEventQueue, IRegionModule
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene m_scene = null;
private IConfigSource m_gConfig;
private IConfig m_startupConfig;
bool enabledYN = false;
private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@@ -65,23 +68,31 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>();
private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
#region IRegionModule methods
public virtual void Initialise(Scene scene, IConfigSource config)
#region INonSharedRegionModule methods
public virtual void Initialise(IConfigSource config)
{
m_gConfig = config;
IConfig startupConfig = m_gConfig.Configs["Startup"];
m_startupConfig = m_gConfig.Configs["Startup"];
}
ReadConfigAndPopulate(scene, startupConfig, "Startup");
public Type ReplaceableInterface
{
get { return null; }
}
public void AddRegion(Scene scene)
{
ReadConfigAndPopulate(scene, m_startupConfig, "Startup");
if (enabledYN)
{
m_scene = scene;
scene.RegisterModuleInterface<IEventQueue>(this);
// Register fallback handler
// Why does EQG Fail on region crossings!
//scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
scene.EventManager.OnNewClient += OnNewClient;
@@ -99,7 +110,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{
m_gConfig = null;
}
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
}
private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
@@ -107,10 +125,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
enabledYN = startupConfig.GetBoolean("EventQueue", true);
}
public void PostInitialise()
{
}
public virtual void Close()
{
}
@@ -120,10 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
get { return "EventQueueGetModule"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
/// <summary>

View File

@@ -25,10 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
@@ -39,7 +41,8 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.Framework.Monitoring
{
public class MonitorModule : IRegionModule
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class MonitorModule : INonSharedRegionModule
{
private Scene m_scene;
private readonly List<IMonitor> m_monitors = new List<IMonitor>();
@@ -62,9 +65,19 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
}
}
#region Implementation of IRegionModule
#region Implementation of INonSharedRegionModule
public void Initialise(Scene scene, IConfigSource source)
public void Initialise(IConfigSource source)
{
}
public Type ReplaceableInterface
{
get { return null; }
}
public void AddRegion(Scene scene)
{
m_scene = scene;
@@ -77,6 +90,51 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage);
}
public void RegionLoaded(Scene scene)
{
m_monitors.Add(new AgentCountMonitor(m_scene));
m_monitors.Add(new ChildAgentCountMonitor(m_scene));
m_monitors.Add(new GCMemoryMonitor());
m_monitors.Add(new ObjectCountMonitor(m_scene));
m_monitors.Add(new PhysicsFrameMonitor(m_scene));
m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
m_monitors.Add(new PWSMemoryMonitor());
m_monitors.Add(new ThreadCountMonitor());
m_monitors.Add(new TotalFrameMonitor(m_scene));
m_monitors.Add(new EventFrameMonitor(m_scene));
m_monitors.Add(new LandFrameMonitor(m_scene));
m_monitors.Add(new LastFrameTimeMonitor(m_scene));
m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
foreach (IAlert alert in m_alerts)
{
alert.OnTriggerAlert += OnTriggerAlert;
}
}
public void RemoveRegion(Scene scene)
{
MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/");
m_monitors.Clear();
foreach (IAlert alert in m_alerts)
{
alert.OnTriggerAlert -= OnTriggerAlert;
}
m_alerts.Clear();
}
public void Close()
{
}
public string Name
{
get { return "Region Health Monitoring Module"; }
}
public Hashtable StatsPage(Hashtable request)
{
// If request was for a specific monitor
@@ -132,49 +190,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
return ereply;
}
public void PostInitialise()
{
m_monitors.Add(new AgentCountMonitor(m_scene));
m_monitors.Add(new ChildAgentCountMonitor(m_scene));
m_monitors.Add(new GCMemoryMonitor());
m_monitors.Add(new ObjectCountMonitor(m_scene));
m_monitors.Add(new PhysicsFrameMonitor(m_scene));
m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
m_monitors.Add(new PWSMemoryMonitor());
m_monitors.Add(new ThreadCountMonitor());
m_monitors.Add(new TotalFrameMonitor(m_scene));
m_monitors.Add(new EventFrameMonitor(m_scene));
m_monitors.Add(new LandFrameMonitor(m_scene));
m_monitors.Add(new LastFrameTimeMonitor(m_scene));
m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
foreach (IAlert alert in m_alerts)
{
alert.OnTriggerAlert += OnTriggerAlert;
}
}
void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
{
m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
}
public void Close()
{
}
public string Name
{
get { return "Region Health Monitoring Module"; }
}
public bool IsSharedModule
{
get { return false; }
}
#endregion
}
}