29 using System.Collections.Generic;
31 using System.Reflection;
33 using System.Text.RegularExpressions;
34 using System.Threading;
37 using log4net.Appender;
39 using log4net.Repository;
41 using OpenMetaverse.StructuredData;
42 using OpenSim.Framework;
43 using OpenSim.Framework.Console;
44 using OpenSim.Framework.Monitoring;
45 using OpenSim.Framework.Servers;
46 using OpenSim.Framework.Servers.HttpServer;
57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
62 public bool SuppressExit {
get; set; }
69 private int m_periodDiagnosticTimerMS = 60 * 60 * 1000;
70 private Timer m_periodicDiagnosticsTimer =
new Timer(60 * 60 * 1000);
75 protected string m_osSecret = String.Empty;
80 get {
return m_httpServer; }
86 m_osSecret = UUID.Random().ToString();
95 RegisterCommonCommands();
96 RegisterCommonComponents(Config);
98 IConfig startupConfig = Config.Configs[
"Startup"];
99 int logShowStatsSeconds = startupConfig.GetInt(
"LogShowStatsSeconds", m_periodDiagnosticTimerMS / 1000);
100 m_periodDiagnosticTimerMS = logShowStatsSeconds * 1000;
101 m_periodicDiagnosticsTimer.Elapsed +=
new ElapsedEventHandler(LogDiagnostics);
102 if (m_periodDiagnosticTimerMS != 0)
104 m_periodicDiagnosticsTimer.Interval = m_periodDiagnosticTimerMS;
105 m_periodicDiagnosticsTimer.Enabled =
true;
111 m_log.Info(
"[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
115 base.ShutdownSpecific();
129 protected virtual List<string>
GetHelpTopics() {
return new List<string>(); }
136 StringBuilder sb =
new StringBuilder(
"DIAGNOSTICS\n\n");
137 sb.Append(GetUptimeReport());
138 sb.Append(StatsManager.SimExtraStats.Report());
139 sb.Append(Environment.NewLine);
140 sb.Append(GetThreadsReport());
150 m_log.Info(
"[STARTUP]: Beginning startup processing");
152 m_log.Info(
"[STARTUP]: version: " + m_version + Environment.NewLine);
157 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
158 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ?
"64" :
"32");
162 TimeSpan timeTaken = DateTime.Now - m_startuptime;
169 public string osSecret
172 get {
return m_osSecret; }
178 if (httpRequest.
Query.ContainsKey(
"callback"))
180 return httpRequest.Query[
"callback"].ToString() +
"(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) +
");";
184 return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version);
virtual List< string > GetHelpTopics()
Provides a list of help topics that are available. Overriding classes should append their topics to t...
string StatReport(IOSHttpRequest httpRequest)
void LogDiagnostics(object source, ElapsedEventArgs e)
Print statistics to the logfile, if they are active
System.Timers.Timer Timer
virtual void Startup()
Performs initialisation of the scene, such as loading configuration from disk.
BaseHttpServer m_httpServer
Common base for the main OpenSimServers (user, grid, inventory, region, etc)
Interactive OpenSim region server
override void ShutdownSpecific()
Should be overriden and referenced by descendents if they need to perform extra shutdown processing ...
virtual void StartupSpecific()
Must be overriden by child classes for their own server specific startup behaviour.