From 170cb935cdfcbd0f3a085f93f5b4aaa66083d888 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 3 Oct 2008 16:06:00 +0000
Subject: * refactor: make shutdown a template method in the same manner as
startup, for consistency's sake
---
OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 +++++++++--
OpenSim/Grid/GridServer/GridServerBase.cs | 4 +---
OpenSim/Grid/MessagingServer/Main.cs | 4 +---
OpenSim/Grid/UserServer/Main.cs | 4 +---
OpenSim/Region/Application/OpenSimBase.cs | 4 +---
5 files changed, 13 insertions(+), 14 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 3705f68..f5e5c18 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -99,6 +99,11 @@ namespace OpenSim.Framework.Servers
/// Must be overriden by child classes for their own server specific startup behaviour.
///
protected abstract void StartupSpecific();
+
+ ///
+ /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
+ ///
+ protected virtual void ShutdownSpecific() {}
///
/// Print statistics to the logfile, if they are active
@@ -222,11 +227,13 @@ namespace OpenSim.Framework.Servers
///
/// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
- ///
+ ///
public virtual void Shutdown()
{
+ ShutdownSpecific();
+
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
-
+
Environment.Exit(0);
}
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 5067a8c..875b4ac 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -167,11 +167,9 @@ namespace OpenSim.Grid.GridServer
*/
}
- public override void Shutdown()
+ protected override void ShutdownSpecific()
{
foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
-
- base.Shutdown();
}
}
}
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 27b9346..537cc48 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -160,11 +160,9 @@ namespace OpenSim.Grid.MessagingServer
m_console.Notice("clear-cache - Clears region cache. Should be done when regions change position. The region cache gets stale after a while.");
}
- public override void Shutdown()
+ protected override void ShutdownSpecific()
{
msgsvc.deregisterWithUserServer();
-
- base.Shutdown();
}
}
}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 23df830..e24b486 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -392,11 +392,9 @@ namespace OpenSim.Grid.UserServer
}
- public override void Shutdown()
+ protected override void ShutdownSpecific()
{
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
-
- base.Shutdown();
}
public void TestResponse(List resp)
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index b802308..54dd51d 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -734,7 +734,7 @@ namespace OpenSim
///
/// Performs any last-minute sanity checking and shuts down the region server
///
- public override void Shutdown()
+ protected override void ShutdownSpecific()
{
if (proxyUrl.Length > 0)
{
@@ -755,8 +755,6 @@ namespace OpenSim
{
m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e);
}
-
- base.Shutdown();
}
///
--
cgit v1.1