diff options
author | Justin Clark-Casey (justincc) | 2014-11-25 23:56:32 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-11-25 23:56:32 +0000 |
commit | 86367d7219b3bd52f63045b2b17bcbde328844ed (patch) | |
tree | 789227d95cb152a437481e741b55d86dfeba9f74 /OpenSim/Region/CoreModules | |
parent | Fix ghosts copy of SimulatorFeatureModule to enable logging. (diff) | |
download | opensim-SC_OLD-86367d7219b3bd52f63045b2b17bcbde328844ed.zip opensim-SC_OLD-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.gz opensim-SC_OLD-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.bz2 opensim-SC_OLD-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.xz |
refactor: Move methods to start a monitored thread, start work in its own thread and run work in the jobengine from Watchdog to a WorkManager class.
This is to achieve a clean separation of concerns - the watchdog is an inappropriate place for work management.
Also adds a WorkManager.RunInThreadPool() class which feeds through to Util.FireAndForget.
Also switches around the name and obj arguments to the new RunInThread() and RunJob() methods so that the callback obj comes after the callback as seen in the SDK and elsewhere
Diffstat (limited to 'OpenSim/Region/CoreModules')
10 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 5eca025..fe9a17d 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -964,11 +964,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
964 | case "assets": | 964 | case "assets": |
965 | con.Output("Ensuring assets are cached for all scenes."); | 965 | con.Output("Ensuring assets are cached for all scenes."); |
966 | 966 | ||
967 | Watchdog.RunInThread(delegate | 967 | WorkManager.RunInThread(delegate |
968 | { | 968 | { |
969 | int assetReferenceTotal = TouchAllSceneAssets(true); | 969 | int assetReferenceTotal = TouchAllSceneAssets(true); |
970 | con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal); | 970 | con.OutputFormat("Completed check with {0} assets.", assetReferenceTotal); |
971 | }, "TouchAllSceneAssets", null); | 971 | }, null, "TouchAllSceneAssets"); |
972 | 972 | ||
973 | break; | 973 | break; |
974 | 974 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 9fb8aa5..6dab227 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -431,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
431 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 431 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, |
432 | options, ReceivedAllAssets); | 432 | options, ReceivedAllAssets); |
433 | 433 | ||
434 | Watchdog.RunInThread(o => ar.Execute(), string.Format("AssetsRequest ({0})", m_scene.Name), null); | 434 | WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name)); |
435 | } | 435 | } |
436 | else | 436 | else |
437 | { | 437 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs index ce6cdc9..f62e7f4 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGIncomingSceneObjectEngine.cs | |||
@@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
134 | 134 | ||
135 | StatsManager.RegisterStat(m_requestsWaitingStat); | 135 | StatsManager.RegisterStat(m_requestsWaitingStat); |
136 | 136 | ||
137 | Watchdog.StartThread( | 137 | WorkManager.StartThread( |
138 | ProcessRequests, | 138 | ProcessRequests, |
139 | string.Format("HG Incoming Scene Object Engine Thread ({0})", Name), | 139 | string.Format("HG Incoming Scene Object Engine Thread ({0})", Name), |
140 | ThreadPriority.Normal, | 140 | ThreadPriority.Normal, |
diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs index a70261e..3abacbd 100644 --- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.CoreModules.Framework | |||
67 | m_timer.Elapsed += ProcessQueue; | 67 | m_timer.Elapsed += ProcessQueue; |
68 | m_timer.Start(); | 68 | m_timer.Start(); |
69 | 69 | ||
70 | //Watchdog.StartThread( | 70 | //WorkManager.StartThread( |
71 | // ProcessQueue, | 71 | // ProcessQueue, |
72 | // "GridServiceRequestThread", | 72 | // "GridServiceRequestThread", |
73 | // ThreadPriority.BelowNormal, | 73 | // ThreadPriority.BelowNormal, |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index d7ea906..af3700b 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
658 | public void Process() | 658 | public void Process() |
659 | { | 659 | { |
660 | _finished = false; | 660 | _finished = false; |
661 | Watchdog.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); | 661 | WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false); |
662 | } | 662 | } |
663 | 663 | ||
664 | /* | 664 | /* |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 470ef02..cbe0e37 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -184,12 +184,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
184 | // Protect ourselves against the caller subsequently modifying the items list | 184 | // Protect ourselves against the caller subsequently modifying the items list |
185 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); | 185 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); |
186 | 186 | ||
187 | Watchdog.RunInThread(delegate | 187 | WorkManager.RunInThread(delegate |
188 | { | 188 | { |
189 | foreach (InventoryItemBase item in items) | 189 | foreach (InventoryItemBase item in items) |
190 | if (!string.IsNullOrEmpty(item.CreatorData)) | 190 | if (!string.IsNullOrEmpty(item.CreatorData)) |
191 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 191 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); |
192 | }, string.Format("GetFolderContent (user {0}, folder {1})", userID, folderID), null); | 192 | }, null, string.Format("GetFolderContent (user {0}, folder {1})", userID, folderID)); |
193 | } | 193 | } |
194 | 194 | ||
195 | return invCol; | 195 | return invCol; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 3e0c9f3..9c6706f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
372 | // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so | 372 | // Start the scripts. We delayed this because we want the OAR to finish loading ASAP, so |
373 | // that users can enter the scene. If we allow the scripts to start in the loop above | 373 | // that users can enter the scene. If we allow the scripts to start in the loop above |
374 | // then they significantly increase the time until the OAR finishes loading. | 374 | // then they significantly increase the time until the OAR finishes loading. |
375 | Watchdog.RunInThread(o => | 375 | WorkManager.RunInThread(o => |
376 | { | 376 | { |
377 | Thread.Sleep(15000); | 377 | Thread.Sleep(15000); |
378 | m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); | 378 | m_log.Info("[ARCHIVER]: Starting scripts in scene objects"); |
@@ -387,7 +387,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
387 | 387 | ||
388 | sceneContext.SceneObjects.Clear(); | 388 | sceneContext.SceneObjects.Clear(); |
389 | } | 389 | } |
390 | }, string.Format("ReadArchiveStartScripts (request {0})", m_requestId), null); | 390 | }, null, string.Format("ReadArchiveStartScripts (request {0})", m_requestId)); |
391 | 391 | ||
392 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); | 392 | m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); |
393 | 393 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index 924b999..b7d7c26 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
200 | m_rootScene.AssetService, m_rootScene.UserAccountService, | 200 | m_rootScene.AssetService, m_rootScene.UserAccountService, |
201 | m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); | 201 | m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); |
202 | 202 | ||
203 | Watchdog.RunInThread(o => ar.Execute(), "Archive Assets Request", null); | 203 | WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request"); |
204 | 204 | ||
205 | // CloseArchive() will be called from ReceivedAllAssets() | 205 | // CloseArchive() will be called from ReceivedAllAssets() |
206 | } | 206 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index ec39bc0..4d99a6e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
227 | finally | 227 | finally |
228 | { | 228 | { |
229 | if (timedOut) | 229 | if (timedOut) |
230 | Watchdog.RunInThread(PerformAssetsRequestCallback, "Archive Assets Request Callback", true); | 230 | WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback"); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
296 | 296 | ||
297 | // We want to stop using the asset cache thread asap | 297 | // We want to stop using the asset cache thread asap |
298 | // as we now need to do the work of producing the rest of the archive | 298 | // as we now need to do the work of producing the rest of the archive |
299 | Watchdog.RunInThread(PerformAssetsRequestCallback, "Archive Assets Request Callback", false); | 299 | WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback"); |
300 | } | 300 | } |
301 | else | 301 | else |
302 | { | 302 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 78fbefe..767f75f 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -381,7 +381,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
381 | 381 | ||
382 | // m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); | 382 | // m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); |
383 | 383 | ||
384 | Watchdog.StartThread( | 384 | WorkManager.StartThread( |
385 | process, | 385 | process, |
386 | string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), | 386 | string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), |
387 | ThreadPriority.BelowNormal, | 387 | ThreadPriority.BelowNormal, |