From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 22 Oct 2009 12:33:23 -0700 Subject: Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated --- OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs index 8ce353c..f24cef6 100644 --- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs @@ -78,8 +78,6 @@ namespace OpenSim.Grid.UserServer.Modules private OpenSim.Framework.BlockingQueue m_NotifyQueue = new OpenSim.Framework.BlockingQueue(); - Thread m_NotifyThread; - private IGridServiceCore m_core; public event AgentLocationDelegate OnAgentLocation; @@ -96,8 +94,8 @@ namespace OpenSim.Grid.UserServer.Modules { m_core = core; m_core.RegisterInterface(this); - m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner)); - m_NotifyThread.Start(); + + Watchdog.StartThread(NotifyQueueRunner, "NotifyQueueRunner", ThreadPriority.Normal, true); } public void PostInitialise() @@ -427,6 +425,8 @@ namespace OpenSim.Grid.UserServer.Modules { TellMessageServersAboutUserLogoffInternal(presence.agentID); } + + Watchdog.UpdateThread(); } } -- cgit v1.1 From a41cd1d0695c01e4096fa0b7696b415a4c7455fc Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 23 Oct 2009 13:14:29 -0700 Subject: * Unregister Mono.Addins event handlers in PluginLoader.Dispose() and always handle PluginLoader with the using pattern. This freed up 121,634,796 bytes on my system * Avoid allocating an Action object every round of the OutgoingPacketHandler * Removed unnecessary semi-colon endings from OpenSim.ini.example [InterestManagement] section --- OpenSim/Grid/GridServer/GridServerBase.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index d63ac2e..113d5c8 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -115,11 +115,11 @@ namespace OpenSim.Grid.GridServer protected virtual void LoadPlugins() { - PluginLoader loader = - new PluginLoader(new GridPluginInitialiser(this)); - - loader.Load("/OpenSim/GridServer"); - m_plugins = loader.Plugins; + using (PluginLoader loader = new PluginLoader(new GridPluginInitialiser(this))) + { + loader.Load("/OpenSim/GridServer"); + m_plugins = loader.Plugins; + } } public override void ShutdownSpecific() -- cgit v1.1 From 2c34619aea074446e53dde80d397973075914bac Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 23 Oct 2009 14:22:21 -0700 Subject: * Changed various modules to not initialize timers unless the module is initialized. Ideally, the timers would not initialize unless the module was actually enabled, but Melanie's work on configuring module loading from a config file should make that unnecessary * Wrapped the Bitmap class used to generate the world map tile in a using statement to dispose of it after the JPEG2000 data is created --- OpenSim/Grid/GridServer/GridServerBase.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 113d5c8..9b0d7ea 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; -using System.Timers; using log4net; using Nini.Config; using OpenSim.Framework; -- cgit v1.1