aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs103
2 files changed, 86 insertions, 57 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0c6cb1b..1ee6f0d 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -32,6 +32,7 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
@@ -52,11 +53,13 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
52 public OSDMap body; 53 public OSDMap body;
53 } 54 }
54 55
55 public class EventQueueGetModule : IEventQueue, IRegionModule 56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
57 public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
56 { 58 {
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
58 protected Scene m_scene = null; 60 protected Scene m_scene = null;
59 private IConfigSource m_gConfig; 61 private IConfigSource m_gConfig;
62 private IConfig m_startupConfig;
60 bool enabledYN = false; 63 bool enabledYN = false;
61 64
62 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); 65 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@@ -65,23 +68,31 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
65 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); 68 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>();
66 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); 69 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
67 70
68 #region IRegionModule methods 71 #region INonSharedRegionModule methods
69 public virtual void Initialise(Scene scene, IConfigSource config) 72 public virtual void Initialise(IConfigSource config)
70 { 73 {
71 m_gConfig = config; 74 m_gConfig = config;
72 75
73 IConfig startupConfig = m_gConfig.Configs["Startup"]; 76 m_startupConfig = m_gConfig.Configs["Startup"];
77 }
74 78
75 ReadConfigAndPopulate(scene, startupConfig, "Startup"); 79 public Type ReplaceableInterface
80 {
81 get { return null; }
82 }
83
84 public void AddRegion(Scene scene)
85 {
86 ReadConfigAndPopulate(scene, m_startupConfig, "Startup");
76 87
77 if (enabledYN) 88 if (enabledYN)
78 { 89 {
79 m_scene = scene; 90 m_scene = scene;
80 scene.RegisterModuleInterface<IEventQueue>(this); 91 scene.RegisterModuleInterface<IEventQueue>(this);
81 92
82 // Register fallback handler 93 // Register fallback handler
83 // Why does EQG Fail on region crossings! 94 // Why does EQG Fail on region crossings!
84 95
85 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); 96 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
86 97
87 scene.EventManager.OnNewClient += OnNewClient; 98 scene.EventManager.OnNewClient += OnNewClient;
@@ -99,18 +110,21 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
99 { 110 {
100 m_gConfig = null; 111 m_gConfig = null;
101 } 112 }
102
103 } 113 }
104 114
105 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) 115 public void RegionLoaded(Scene scene)
106 { 116 {
107 enabledYN = startupConfig.GetBoolean("EventQueue", true);
108 } 117 }
109 118
110 public void PostInitialise() 119 public void RemoveRegion(Scene scene)
111 { 120 {
112 } 121 }
113 122
123 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
124 {
125 enabledYN = startupConfig.GetBoolean("EventQueue", true);
126 }
127
114 public virtual void Close() 128 public virtual void Close()
115 { 129 {
116 } 130 }
@@ -120,10 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
120 get { return "EventQueueGetModule"; } 134 get { return "EventQueueGetModule"; }
121 } 135 }
122 136
123 public bool IsSharedModule
124 {
125 get { return false; }
126 }
127 #endregion 137 #endregion
128 138
129 /// <summary> 139 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index f15f8f6..0135d33 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -25,10 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections; 29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Reflection; 31using System.Reflection;
31using log4net; 32using log4net;
33using Mono.Addins;
32using Nini.Config; 34using Nini.Config;
33using OpenMetaverse; 35using OpenMetaverse;
34using OpenSim.Framework; 36using OpenSim.Framework;
@@ -39,7 +41,8 @@ using OpenSim.Region.Framework.Scenes;
39 41
40namespace OpenSim.Region.CoreModules.Framework.Monitoring 42namespace OpenSim.Region.CoreModules.Framework.Monitoring
41{ 43{
42 public class MonitorModule : IRegionModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MonitorModule : INonSharedRegionModule
43 { 46 {
44 private Scene m_scene; 47 private Scene m_scene;
45 private readonly List<IMonitor> m_monitors = new List<IMonitor>(); 48 private readonly List<IMonitor> m_monitors = new List<IMonitor>();
@@ -62,9 +65,19 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
62 } 65 }
63 } 66 }
64 67
65 #region Implementation of IRegionModule 68 #region Implementation of INonSharedRegionModule
66 69
67 public void Initialise(Scene scene, IConfigSource source) 70 public void Initialise(IConfigSource source)
71 {
72
73 }
74
75 public Type ReplaceableInterface
76 {
77 get { return null; }
78 }
79
80 public void AddRegion(Scene scene)
68 { 81 {
69 m_scene = scene; 82 m_scene = scene;
70 83
@@ -77,6 +90,51 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
77 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); 90 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage);
78 } 91 }
79 92
93 public void RegionLoaded(Scene scene)
94 {
95 m_monitors.Add(new AgentCountMonitor(m_scene));
96 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
97 m_monitors.Add(new GCMemoryMonitor());
98 m_monitors.Add(new ObjectCountMonitor(m_scene));
99 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
100 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
101 m_monitors.Add(new PWSMemoryMonitor());
102 m_monitors.Add(new ThreadCountMonitor());
103 m_monitors.Add(new TotalFrameMonitor(m_scene));
104 m_monitors.Add(new EventFrameMonitor(m_scene));
105 m_monitors.Add(new LandFrameMonitor(m_scene));
106 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
107
108 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
109
110 foreach (IAlert alert in m_alerts)
111 {
112 alert.OnTriggerAlert += OnTriggerAlert;
113 }
114 }
115
116 public void RemoveRegion(Scene scene)
117 {
118 MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/");
119 m_monitors.Clear();
120
121 foreach (IAlert alert in m_alerts)
122 {
123 alert.OnTriggerAlert -= OnTriggerAlert;
124 }
125 m_alerts.Clear();
126 }
127
128 public void Close()
129 {
130
131 }
132
133 public string Name
134 {
135 get { return "Region Health Monitoring Module"; }
136 }
137
80 public Hashtable StatsPage(Hashtable request) 138 public Hashtable StatsPage(Hashtable request)
81 { 139 {
82 // If request was for a specific monitor 140 // If request was for a specific monitor
@@ -132,49 +190,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
132 return ereply; 190 return ereply;
133 } 191 }
134 192
135 public void PostInitialise()
136 {
137 m_monitors.Add(new AgentCountMonitor(m_scene));
138 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
139 m_monitors.Add(new GCMemoryMonitor());
140 m_monitors.Add(new ObjectCountMonitor(m_scene));
141 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
142 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
143 m_monitors.Add(new PWSMemoryMonitor());
144 m_monitors.Add(new ThreadCountMonitor());
145 m_monitors.Add(new TotalFrameMonitor(m_scene));
146 m_monitors.Add(new EventFrameMonitor(m_scene));
147 m_monitors.Add(new LandFrameMonitor(m_scene));
148 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
149
150 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
151
152 foreach (IAlert alert in m_alerts)
153 {
154 alert.OnTriggerAlert += OnTriggerAlert;
155 }
156 }
157
158 void OnTriggerAlert(System.Type reporter, string reason, bool fatal) 193 void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
159 { 194 {
160 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); 195 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
161 } 196 }
162
163 public void Close()
164 {
165
166 }
167
168 public string Name
169 {
170 get { return "Region Health Monitoring Module"; }
171 }
172
173 public bool IsSharedModule
174 {
175 get { return false; }
176 }
177
178 #endregion 197 #endregion
179 } 198 }
180} 199}