* refactor: make shutdown a template method in the same manner as startup, for consistency's sake

0.6.0-stable
Justin Clarke Casey 2008-10-03 16:06:00 +00:00
parent 0487c3158b
commit 170cb935cd
5 changed files with 13 additions and 14 deletions

View File

@ -99,6 +99,11 @@ namespace OpenSim.Framework.Servers
/// Must be overriden by child classes for their own server specific startup behaviour. /// Must be overriden by child classes for their own server specific startup behaviour.
/// </summary> /// </summary>
protected abstract void StartupSpecific(); protected abstract void StartupSpecific();
/// <summary>
/// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
/// </summary>
protected virtual void ShutdownSpecific() {}
/// <summary> /// <summary>
/// Print statistics to the logfile, if they are active /// Print statistics to the logfile, if they are active
@ -222,11 +227,13 @@ namespace OpenSim.Framework.Servers
/// <summary> /// <summary>
/// Should be overriden and referenced by descendents if they need to perform extra shutdown processing /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
/// </summary> /// </summary>
public virtual void Shutdown() public virtual void Shutdown()
{ {
ShutdownSpecific();
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
Environment.Exit(0); Environment.Exit(0);
} }

View File

@ -167,11 +167,9 @@ namespace OpenSim.Grid.GridServer
*/ */
} }
public override void Shutdown() protected override void ShutdownSpecific()
{ {
foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
base.Shutdown();
} }
} }
} }

View File

@ -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."); 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(); msgsvc.deregisterWithUserServer();
base.Shutdown();
} }
} }
} }

View File

@ -392,11 +392,9 @@ namespace OpenSim.Grid.UserServer
} }
public override void Shutdown() protected override void ShutdownSpecific()
{ {
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
base.Shutdown();
} }
public void TestResponse(List<InventoryFolderBase> resp) public void TestResponse(List<InventoryFolderBase> resp)

View File

@ -734,7 +734,7 @@ namespace OpenSim
/// <summary> /// <summary>
/// Performs any last-minute sanity checking and shuts down the region server /// Performs any last-minute sanity checking and shuts down the region server
/// </summary> /// </summary>
public override void Shutdown() protected override void ShutdownSpecific()
{ {
if (proxyUrl.Length > 0) if (proxyUrl.Length > 0)
{ {
@ -755,8 +755,6 @@ namespace OpenSim
{ {
m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e); m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e);
} }
base.Shutdown();
} }
/// <summary> /// <summary>