From 4a475ca2be259cf3e31b29148f04f325b304a6c5 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 25 Aug 2008 23:21:07 +0000 Subject: [PATCH] * minor: refactor thread report into a method that returns a string rather than displays information directly --- .../Framework/Servers/BaseOpenSimServer.cs | 44 ++++++++++++------- OpenSim/Grid/UserServer/Main.cs | 1 - OpenSim/Region/Application/OpenSim.cs | 2 +- .../ClientStack/LindenUDP/LLClientView.cs | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 29ee14308d..ea3eed1b20 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -110,6 +110,32 @@ namespace OpenSim.Framework.Servers m_log.Debug(sb); } + + /// + /// Get a report about the registered threads in this server. + /// + protected string GetThreadReport() + { + StringBuilder sb = new StringBuilder(); + + List threads = ThreadTracker.GetThreads(); + if (threads == null) + { + sb.Append("Thread tracking is only enabled in DEBUG mode."); + } + else + { + sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine); + foreach (Thread t in threads) + { + sb.Append( + "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive + + ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine); + } + } + + return sb.ToString(); + } /// /// Return a report about the uptime of this server @@ -261,7 +287,7 @@ namespace OpenSim.Framework.Servers /// Show help information /// /// - public virtual void ShowHelp(string[] helpArgs) + protected virtual void ShowHelp(string[] helpArgs) { if (helpArgs.Length == 0) { @@ -283,7 +309,7 @@ namespace OpenSim.Framework.Servers return; } - } + } /// /// Outputs to the console information about the region @@ -308,19 +334,7 @@ namespace OpenSim.Framework.Servers break; case "threads": - List threads = ThreadTracker.GetThreads(); - if (threads == null) - { - Notice("Thread tracking is only enabled in DEBUG mode."); - } - else - { - Notice(threads.Count + " threads are being tracked:"); - foreach (Thread t in threads) - { - Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); - } - } + Notice(GetThreadReport()); break; case "uptime": diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 20d0cbf445..db38b329ed 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -248,7 +248,6 @@ namespace OpenSim.Grid.UserServer break; case "logoff-user": - if (cmdparams.Length >= 3) { string firstname = cmdparams[0]; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index fb62504415..ce44f997a6 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -602,7 +602,7 @@ namespace OpenSim } } - public override void ShowHelp(string[] helpArgs) + protected override void ShowHelp(string[] helpArgs) { base.ShowHelp(helpArgs); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4a50d92570..fc993346be 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // ~ClientView() // { - // m_log.Info("[CLIENTVIEW]: Destructor called"); + // m_log.Info("[CLIENT]: LLClientView destructor called"); // } /* static variables */