* Move shutdown processing to base OpenSimServer, overriding the method where appropriate

* This also means that the command quit (as well as shutdown) will now close down grid servers (instead of only being in place for the region server)
0.6.0-stable
Justin Clarke Casey 2008-05-07 16:24:15 +00:00
parent 2cf025d9cb
commit 250fb6f5db
8 changed files with 50 additions and 67 deletions

View File

@ -47,7 +47,16 @@ namespace OpenSim.Framework.Servers
public BaseOpenSimServer() public BaseOpenSimServer()
{ {
m_startuptime = DateTime.Now; m_startuptime = DateTime.Now;
} }
/// <summary>
/// Should be overriden by descendents if they need to perform extra shutdown processing
/// </summary>
protected virtual void Shutdown()
{
m_console.Close();
Environment.Exit(0);
}
/// <summary> /// <summary>
/// Runs commands issued by the server console from the operator /// Runs commands issued by the server console from the operator
@ -59,7 +68,9 @@ namespace OpenSim.Framework.Servers
switch (command) switch (command)
{ {
case "help": case "help":
m_console.Notice("quit - equivalent to shutdown.");
m_console.Notice("show uptime - show server startup and uptime."); m_console.Notice("show uptime - show server startup and uptime.");
m_console.Notice("shutdown - shutdown the server.\n");
break; break;
case "show": case "show":
@ -68,6 +79,11 @@ namespace OpenSim.Framework.Servers
Show(cmdparams[0]); Show(cmdparams[0]);
} }
break; break;
case "quit":
case "shutdown":
Shutdown();
break;
} }
} }

View File

@ -181,9 +181,7 @@ namespace OpenSim.Grid.AssetServer
switch (cmd) switch (cmd)
{ {
case "help": case "help":
m_console.Notice( m_console.Notice("stats - statistical information for this server");
@"shutdown - shutdown this asset server (USE CAUTION!)
stats - statistical information for this server");
break; break;

View File

@ -177,23 +177,12 @@ namespace OpenSim.Grid.GridServer
} }
*/ */
} }
public override void RunCmd(string cmd, string[] cmdparams) protected override void Shutdown()
{ {
base.RunCmd(cmd, cmdparams); foreach (IGridPlugin plugin in m_plugins) plugin.Close();
switch (cmd) base.Shutdown();
{
case "help":
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break;
case "shutdown":
foreach (IGridPlugin plugin in m_plugins) plugin.Close();
m_console.Close();
Environment.Exit(0);
break;
}
} }
} }
} }

View File

@ -144,10 +144,6 @@ namespace OpenSim.Grid.InventoryServer
case "add-user": case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break; break;
case "shutdown":
m_console.Close();
Environment.Exit(0);
break;
} }
} }
} }

View File

@ -140,29 +140,13 @@ namespace OpenSim.Grid.MessagingServer
// m_lastCreatedUser = userID; // m_lastCreatedUser = userID;
break; break;
} }
} }
public override void RunCmd(string cmd, string[] cmdparams) protected override void Shutdown()
{ {
base.RunCmd(cmd, cmdparams); msgsvc.deregisterWithUserServer();
switch (cmd) base.Shutdown();
{
case "help":
m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
break;
case "shutdown":
msgsvc.deregisterWithUserServer();
m_console.Close();
Environment.Exit(0);
break;
}
}
public override void Show(string ShowWhat)
{
base.Show(ShowWhat);
} }
} }
} }

View File

@ -97,10 +97,6 @@ namespace OpenSim.Grid.ScriptServer
} }
} }
~ScriptServerMain()
{
}
protected ConsoleBase CreateConsole() protected ConsoleBase CreateConsole()
{ {
return new ConsoleBase("ScriptServer", this); return new ConsoleBase("ScriptServer", this);

View File

@ -219,19 +219,12 @@ namespace OpenSim.Grid.UserServer
{ {
case "help": case "help":
m_console.Notice("create user - create a new user"); m_console.Notice("create user - create a new user");
m_console.Notice("stats - statistical information for this server"); m_console.Notice("stats - statistical information for this server");
m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
break; break;
case "create": case "create":
do_create(cmdparams[0]); do_create(cmdparams[0]);
break; break;
case "shutdown":
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
m_console.Close();
Environment.Exit(0);
break;
case "stats": case "stats":
m_console.Notice(StatsManager.UserStats.Report()); m_console.Notice(StatsManager.UserStats.Report());
@ -251,6 +244,13 @@ namespace OpenSim.Grid.UserServer
} }
} }
protected override void Shutdown()
{
m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
base.Shutdown();
}
public void TestResponse(List<InventoryFolderBase> resp) public void TestResponse(List<InventoryFolderBase> resp)
{ {
m_console.Notice("response got"); m_console.Notice("response got");

View File

@ -129,9 +129,21 @@ namespace OpenSim
{ {
RunCommandScript(m_shutdownCommandsFile); RunCommandScript(m_shutdownCommandsFile);
} }
InternalShutdown();
m_console.Close(); if (proxyUrl.Length > 0)
Environment.Exit(0); {
Util.XmlRpcCommand(proxyUrl, "Stop");
}
m_log.Info("[SHUTDOWN]: Closing all threads");
m_log.Info("[SHUTDOWN]: Killing listener thread");
m_log.Info("[SHUTDOWN]: Killing clients");
// TODO: implement this
m_log.Info("[SHUTDOWN]: Closing console and terminating");
m_sceneManager.Close();
base.Shutdown();
} }
private void RunAutoTimerScript(object sender, EventArgs e) private void RunAutoTimerScript(object sender, EventArgs e)
@ -259,7 +271,6 @@ namespace OpenSim
m_console.Notice("load-xml [filename] - load prims from XML"); m_console.Notice("load-xml [filename] - load prims from XML");
m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); m_console.Notice("load-xml2 [filename] - load prims from XML using version 2 format");
m_console.Notice("permissions [true/false] - turn on/off permissions on the scene"); m_console.Notice("permissions [true/false] - turn on/off permissions on the scene");
m_console.Notice("quit - equivalent to shutdown.");
m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
m_console.Notice("remove-region [name] - remove a region"); m_console.Notice("remove-region [name] - remove a region");
m_console.Notice("save-xml [filename] - save prims to XML"); m_console.Notice("save-xml [filename] - save prims to XML");
@ -271,7 +282,6 @@ namespace OpenSim
m_console.Notice("show modules - shows info about loaded modules."); m_console.Notice("show modules - shows info about loaded modules.");
m_console.Notice("show stats - statistical information for this server not displayed in the client"); m_console.Notice("show stats - statistical information for this server not displayed in the client");
m_console.Notice("threads - list threads"); m_console.Notice("threads - list threads");
m_console.Notice("shutdown - disconnect all clients and shutdown.");
m_console.Notice("config set section field value - set a config value"); m_console.Notice("config set section field value - set a config value");
m_console.Notice("config get section field - get a config value"); m_console.Notice("config get section field - get a config value");
m_console.Notice("config save - save OpenSim.ini"); m_console.Notice("config save - save OpenSim.ini");
@ -422,12 +432,6 @@ namespace OpenSim
} }
break; break;
case "exit":
case "quit":
case "shutdown":
Shutdown();
break;
case "restart": case "restart":
m_sceneManager.RestartCurrentScene(); m_sceneManager.RestartCurrentScene();
break; break;