* 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

@ -49,6 +49,15 @@ namespace OpenSim.Framework.Servers
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>
/// Runs commands issued by the server console from the operator
/// </summary>
@ -59,7 +68,9 @@ namespace OpenSim.Framework.Servers
switch (command)
{
case "help":
m_console.Notice("quit - equivalent to shutdown.");
m_console.Notice("show uptime - show server startup and uptime.");
m_console.Notice("shutdown - shutdown the server.\n");
break;
case "show":
@ -68,6 +79,11 @@ namespace OpenSim.Framework.Servers
Show(cmdparams[0]);
}
break;
case "quit":
case "shutdown":
Shutdown();
break;
}
}

View File

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

View File

@ -178,22 +178,11 @@ namespace OpenSim.Grid.GridServer
*/
}
public override void RunCmd(string cmd, string[] cmdparams)
protected override void Shutdown()
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
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;
}
base.Shutdown();
}
}
}

View File

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

View File

@ -142,27 +142,11 @@ namespace OpenSim.Grid.MessagingServer
}
}
public override void RunCmd(string cmd, string[] cmdparams)
protected override void Shutdown()
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
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);
base.Shutdown();
}
}
}

View File

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

View File

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

View File

@ -129,9 +129,21 @@ namespace OpenSim
{
RunCommandScript(m_shutdownCommandsFile);
}
InternalShutdown();
m_console.Close();
Environment.Exit(0);
if (proxyUrl.Length > 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)
@ -259,7 +271,6 @@ namespace OpenSim
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("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("remove-region [name] - remove a region");
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 stats - statistical information for this server not displayed in the client");
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 get section field - get a config value");
m_console.Notice("config save - save OpenSim.ini");
@ -422,12 +432,6 @@ namespace OpenSim
}
break;
case "exit":
case "quit":
case "shutdown":
Shutdown();
break;
case "restart":
m_sceneManager.RestartCurrentScene();
break;