From 70124a3213d013098507b08ed7f9301da6845882 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 3 Oct 2008 15:11:29 +0000 Subject: [PATCH] * refactor: make startup a template method --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 +++++++++-- OpenSim/Grid/AssetServer/Main.cs | 4 +--- OpenSim/Grid/GridServer/GridServerBase.cs | 4 +--- OpenSim/Grid/InventoryServer/Main.cs | 4 +--- OpenSim/Grid/MessagingServer/Main.cs | 6 +----- OpenSim/Grid/UserServer/Main.cs | 4 +--- OpenSim/Region/Application/OpenSimBase.cs | 6 +++--- OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 3 +++ OpenSim/Region/ClientStack/RegionApplicationBase.cs | 4 +--- 9 files changed, 21 insertions(+), 25 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index e799c23831..099060aec3 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -94,6 +94,11 @@ namespace OpenSim.Framework.Servers Thread.CurrentThread.Name = "ConsoleThread"; ThreadTracker.Add(Thread.CurrentThread); } + + /// + /// Must be overriden by child classes for their own server specific startup behaviour. + /// + protected abstract void StartupSpecific(); /// /// Print statistics to the logfile, if they are active @@ -202,11 +207,13 @@ namespace OpenSim.Framework.Servers /// public virtual void Startup() { - m_log.Info("[STARTUP]: Beginning startup processing"); + m_log.Info("[STARTUP]: Beginning startup processing"); EnhanceVersionInformation(); - + m_log.Info("[STARTUP]: Version: " + m_version + "\n"); + + StartupSpecific(); } /// diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 3f856919c0..1c9275b2ab 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -80,10 +80,8 @@ namespace OpenSim.Grid.AssetServer MainConsole.Instance = m_console; } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); m_log.Info("[ASSET]: Setting up asset DB"); diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index d83027af46..5067a8cc18 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -73,10 +73,8 @@ namespace OpenSim.Grid.GridServer } } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - m_config = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); SetupGridManager(); diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 3b990e70c5..8be6a232fc 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -62,10 +62,8 @@ namespace OpenSim.Grid.InventoryServer MainConsole.Instance = m_console; } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); m_inventoryService = new GridInventoryService(config.UserServerURL); diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index c64c74eb5c..27b9346cd5 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -56,8 +56,6 @@ namespace OpenSim.Grid.MessagingServer m_log.Info("Launching MessagingServer..."); - - OpenMessage_Main messageserver = new OpenMessage_Main(); messageserver.Startup(); @@ -80,10 +78,8 @@ namespace OpenSim.Grid.MessagingServer } } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); m_log.Info("[REGION]: Starting HTTP process"); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index d3d5c8c59f..23df830c78 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -88,10 +88,8 @@ namespace OpenSim.Grid.UserServer } } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); m_stats = StatsManager.StartCollectingUserStats(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 445fba0370..b802308024 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -363,10 +363,10 @@ namespace OpenSim /// /// Performs initialisation of the scene, such as loading configuration from disk. /// - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - + base.StartupSpecific(); + m_stats = StatsManager.StartCollectingSimExtraStats(); LibraryRootFolder libraryRootFolder = new LibraryRootFolder(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 39ade569c7..e4e5e9a790 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs @@ -44,6 +44,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Is throttling enabled at all? + /// private bool m_enabled = true; private OpenSim.Framework.BlockingQueue SendQueue; diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 4c6d51fdd2..cee7ffa179 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -71,10 +71,8 @@ namespace OpenSim.Region.ClientStack get { return m_sceneManager; } } - public override void Startup() + protected override void StartupSpecific() { - base.Startup(); - m_storageManager = CreateStorageManager(m_storageConnectionString, m_estateConnectionString); m_clientStackManager = CreateClientStackManager();