aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-04 16:22:58 +0000
committerJustin Clarke Casey2008-02-04 16:22:58 +0000
commita1c9349d4765833691e7816d7f4df7bd37b9ee36 (patch)
tree2e108496bc6761f6ed1ec671a97bf6b4ba5e6137 /OpenSim/Grid
parent* Added note in CONTRIBUTORS.txt for _someone/mikkopa - RealXtend (diff)
downloadopensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.zip
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.gz
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.bz2
opensim-SC-a1c9349d4765833691e7816d7f4df7bd37b9ee36.tar.xz
Refactor only: serve stats objects directly through StatsManager singleton
Diffstat (limited to 'OpenSim/Grid')
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs10
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs14
-rw-r--r--OpenSim/Grid/UserServer/Main.cs12
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs4
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs11
5 files changed, 17 insertions, 34 deletions
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index c9f7e8e..23b0afa 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -52,9 +52,7 @@ namespace OpenSim.Grid.AssetServer
52 // Temporarily hardcoded - should be a plugin 52 // Temporarily hardcoded - should be a plugin
53 protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); 53 protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
54 54
55 private IAssetProvider m_assetProvider; 55 private IAssetProvider m_assetProvider;
56
57 protected AssetStatsReporter m_stats;
58 56
59 [STAThread] 57 [STAThread]
60 public static void Main(string[] args) 58 public static void Main(string[] args)
@@ -101,9 +99,9 @@ namespace OpenSim.Grid.AssetServer
101 m_console.Verbose("ASSET", "Starting HTTP process"); 99 m_console.Verbose("ASSET", "Starting HTTP process");
102 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); 100 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
103 101
104 m_stats = new AssetStatsReporter(); 102 StatsManager.StartCollectingAssetStats();
105 103
106 httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider, m_stats)); 104 httpServer.AddStreamHandler(new GetAssetStreamHandler(this, m_assetProvider));
107 httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider)); 105 httpServer.AddStreamHandler(new PostAssetStreamHandler(this, m_assetProvider));
108 106
109 httpServer.Start(); 107 httpServer.Start();
@@ -184,7 +182,7 @@ namespace OpenSim.Grid.AssetServer
184 break; 182 break;
185 183
186 case "stats": 184 case "stats":
187 m_console.Notice("STATS", Environment.NewLine + m_stats.Report()); 185 m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report());
188 break; 186 break;
189 187
190 case "shutdown": 188 case "shutdown":
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 9b288a7..5c497b6 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -43,22 +43,18 @@ namespace OpenSim.Grid.AssetServer
43 { 43 {
44 private OpenAsset_Main m_assetManager; 44 private OpenAsset_Main m_assetManager;
45 private IAssetProvider m_assetProvider; 45 private IAssetProvider m_assetProvider;
46 private AssetStatsReporter m_stats;
47 46
48 /// <summary> 47 /// <summary>
49 /// Constructor. 48 /// Constructor.
50 /// </summary> 49 /// </summary>
51 /// <param name="assetManager"></param> 50 /// <param name="assetManager"></param>
52 /// <param name="assetProvider"></param> 51 /// <param name="assetProvider"></param>
53 /// <param name="stats">Can be null if stats collection isn't required</param> 52 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider)
54 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider,
55 AssetStatsReporter stats)
56 : base("GET", "/assets") 53 : base("GET", "/assets")
57 { 54 {
58 MainLog.Instance.Verbose("REST", "In Get Request"); 55 MainLog.Instance.Verbose("REST", "In Get Request");
59 m_assetManager = assetManager; 56 m_assetManager = assetManager;
60 m_assetProvider = assetProvider; 57 m_assetProvider = assetProvider;
61 m_stats = stats;
62 } 58 }
63 59
64 public override byte[] Handle(string path, Stream request) 60 public override byte[] Handle(string path, Stream request)
@@ -80,8 +76,8 @@ namespace OpenSim.Grid.AssetServer
80 return result; 76 return result;
81 } 77 }
82 78
83 if (m_stats != null) 79 if (StatsManager.AssetStats != null)
84 m_stats.AddRequest(); 80 StatsManager.AssetStats.AddRequest();
85 81
86 AssetBase asset = m_assetProvider.FetchAsset(assetID); 82 AssetBase asset = m_assetProvider.FetchAsset(assetID);
87 if (asset != null) 83 if (asset != null)
@@ -107,8 +103,8 @@ namespace OpenSim.Grid.AssetServer
107 } 103 }
108 else 104 else
109 { 105 {
110 if (m_stats != null) 106 if (StatsManager.AssetStats != null)
111 m_stats.AddNotFoundRequest(); 107 StatsManager.AssetStats.AddNotFoundRequest();
112 108
113 MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID); 109 MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID);
114 } 110 }
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 2650694..20828ba 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -46,9 +46,7 @@ namespace OpenSim.Grid.UserServer
46 46
47 public UserManager m_userManager; 47 public UserManager m_userManager;
48 public UserLoginService m_loginService; 48 public UserLoginService m_loginService;
49 public MessageServersConnector m_messagesService; 49 public MessageServersConnector m_messagesService;
50
51 protected UserStatsReporter m_stats;
52 50
53 private LogBase m_console; 51 private LogBase m_console;
54 private LLUUID m_lastCreatedUser = LLUUID.Random(); 52 private LLUUID m_lastCreatedUser = LLUUID.Random();
@@ -89,15 +87,15 @@ namespace OpenSim.Grid.UserServer
89 { 87 {
90 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 88 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
91 89
92 m_stats = new UserStatsReporter(); 90 StatsManager.StartCollectingUserStats();
93 91
94 MainLog.Instance.Verbose("REGION", "Establishing data connection"); 92 MainLog.Instance.Verbose("REGION", "Establishing data connection");
95 m_userManager = new UserManager(m_stats); 93 m_userManager = new UserManager();
96 m_userManager._config = Cfg; 94 m_userManager._config = Cfg;
97 m_userManager.AddPlugin(Cfg.DatabaseProvider); 95 m_userManager.AddPlugin(Cfg.DatabaseProvider);
98 96
99 m_loginService = new UserLoginService( 97 m_loginService = new UserLoginService(
100 m_userManager, new LibraryRootFolder(), m_stats, Cfg, Cfg.DefaultStartupMsg); 98 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
101 99
102 m_messagesService = new MessageServersConnector(MainLog.Instance); 100 m_messagesService = new MessageServersConnector(MainLog.Instance);
103 101
@@ -199,7 +197,7 @@ namespace OpenSim.Grid.UserServer
199 break; 197 break;
200 198
201 case "stats": 199 case "stats":
202 MainLog.Instance.Notice("STATS", Environment.NewLine + m_stats.Report()); 200 MainLog.Instance.Notice("STATS", Environment.NewLine + StatsManager.UserStats.Report());
203 break; 201 break;
204 202
205 case "test-inventory": 203 case "test-inventory":
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 0f02ad2..10f9468 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -55,8 +55,8 @@ namespace OpenSim.Grid.UserServer
55 55
56 public UserLoginService( 56 public UserLoginService(
57 UserManagerBase userManager, LibraryRootFolder libraryRootFolder, 57 UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
58 UserStatsReporter statsCollector, UserConfig config, string welcomeMess) 58 UserConfig config, string welcomeMess)
59 : base(userManager, libraryRootFolder, statsCollector, welcomeMess) 59 : base(userManager, libraryRootFolder, welcomeMess)
60 { 60 {
61 m_config = config; 61 m_config = config;
62 } 62 }
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 778aec1..c36de7f 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -38,16 +38,7 @@ using OpenSim.Framework.UserManagement;
38namespace OpenSim.Grid.UserServer 38namespace OpenSim.Grid.UserServer
39{ 39{
40 public class UserManager : UserManagerBase 40 public class UserManager : UserManagerBase
41 { 41 {
42 /// <summary>
43 /// Constructor.
44 /// </summary>
45 /// <param name="statsCollector">Can be null if stats collection is not required.
46 /// </param>
47 public UserManager(UserStatsReporter statsCollector) : base(statsCollector)
48 {
49 }
50
51 /// <summary> 42 /// <summary>
52 /// Deletes an active agent session 43 /// Deletes an active agent session
53 /// </summary> 44 /// </summary>