From 3376b82501000692d6dac24b051af738cdaf2737 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 24 May 2007 12:16:50 +0000 Subject: Some more code refactoring, plus a restructuring of the directories so that the Grid servers can be a separate solution to the region server. --- .../GridServerManager.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs (limited to 'OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs') diff --git a/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs new file mode 100644 index 0000000..7ebf66a --- /dev/null +++ b/OpenGridServices-Source/OpenGrid.Framework.Manager/GridServerManager.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Nwc.XmlRpc; +using System.Threading; +using libsecondlife; + +namespace OpenGrid.Framework.Manager { + + public class GridServerManager + { + public static GridManagerCallback thecallback; + + public static string sendkey; + public static string recvkey; + + public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + if(requestData.ContainsKey("session_id")) { + if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) { + responseData["msg"]="Shutdown command accepted"; + (new Thread(new ThreadStart(ZOMGServerIsNowTerminallyIll))).Start(); + } else { + response.IsFault=true; + responseData["error"]="bad session ID"; + } + } else { + response.IsFault=true; + responseData["error"]="no session ID"; + } + + response.Value = responseData; + return response; + } + + // Brought to by late-night coding + public static void ZOMGServerIsNowTerminallyIll() + { + Console.WriteLine("ZOMG! THIS SERVER IS TERMINALLY ILL - WE GOT A SHUTDOWN REQUEST FROM A GRID MANAGER!!!!"); + Console.WriteLine("We have 3 seconds to live..."); + Thread.Sleep(3000); + thecallback("shutdown"); + } + } +} + -- cgit v1.1