aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden
diff options
context:
space:
mode:
authorUbitUmarov2018-01-22 00:43:33 +0000
committerUbitUmarov2018-01-22 00:43:33 +0000
commitd4a5454f3ca0adce50f22cb523c11dd781daf7e5 (patch)
treea27d27fea11ff62bfc1d64a2462654dfeb32a304 /OpenSim/Region/ClientStack/Linden
parentgive BlockingCollection more chances (diff)
downloadopensim-SC-d4a5454f3ca0adce50f22cb523c11dd781daf7e5.zip
opensim-SC-d4a5454f3ca0adce50f22cb523c11dd781daf7e5.tar.gz
opensim-SC-d4a5454f3ca0adce50f22cb523c11dd781daf7e5.tar.bz2
opensim-SC-d4a5454f3ca0adce50f22cb523c11dd781daf7e5.tar.xz
give BlockingCollection more chances
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs45
1 files changed, 23 insertions, 22 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 9cfa488..c02bcb0 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -28,14 +28,13 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections.Concurrent;
31using System.Reflection; 32using System.Reflection;
32using System.Threading; 33using System.Threading;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using Mono.Addins; 36using Mono.Addins;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
40using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
@@ -55,7 +54,7 @@ namespace OpenSim.Region.ClientStack.Linden
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")] 54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebFetchInvDescModule")]
56 public class WebFetchInvDescModule : INonSharedRegionModule 55 public class WebFetchInvDescModule : INonSharedRegionModule
57 { 56 {
58 class aPollRequest 57 class APollRequest
59 { 58 {
60 public PollServiceInventoryEventArgs thepoll; 59 public PollServiceInventoryEventArgs thepoll;
61 public UUID reqID; 60 public UUID reqID;
@@ -98,8 +97,7 @@ namespace OpenSim.Region.ClientStack.Linden
98 97
99 private static Thread[] m_workerThreads = null; 98 private static Thread[] m_workerThreads = null;
100 99
101 private static OpenSim.Framework.BlockingQueue<aPollRequest> m_queue = 100 private static BlockingCollection<APollRequest> m_queue = new BlockingCollection<APollRequest>();
102 new OpenSim.Framework.BlockingQueue<aPollRequest>();
103 101
104 private static int m_NumberScenes = 0; 102 private static int m_NumberScenes = 0;
105 103
@@ -180,7 +178,7 @@ namespace OpenSim.Region.ClientStack.Linden
180 "httpfetch", 178 "httpfetch",
181 StatType.Pull, 179 StatType.Pull,
182 MeasuresOfInterest.AverageChangeOverTime, 180 MeasuresOfInterest.AverageChangeOverTime,
183 stat => { stat.Value = m_queue.Count(); }, 181 stat => { stat.Value = m_queue.Count; },
184 StatVerbosity.Debug); 182 StatVerbosity.Debug);
185 183
186 StatsManager.RegisterStat(s_processedRequestsStat); 184 StatsManager.RegisterStat(s_processedRequestsStat);
@@ -290,7 +288,7 @@ namespace OpenSim.Region.ClientStack.Linden
290 { 288 {
291 ScenePresence sp = m_module.Scene.GetScenePresence(Id); 289 ScenePresence sp = m_module.Scene.GetScenePresence(Id);
292 290
293 aPollRequest reqinfo = new aPollRequest(); 291 APollRequest reqinfo = new APollRequest();
294 reqinfo.thepoll = this; 292 reqinfo.thepoll = this;
295 reqinfo.reqID = x; 293 reqinfo.reqID = x;
296 reqinfo.request = y; 294 reqinfo.request = y;
@@ -347,7 +345,7 @@ namespace OpenSim.Region.ClientStack.Linden
347 m_queue.PriorityEnqueue(reqinfo); 345 m_queue.PriorityEnqueue(reqinfo);
348 else 346 else
349*/ 347*/
350 m_queue.Enqueue(reqinfo); 348 m_queue.Add(reqinfo);
351 }; 349 };
352 350
353 NoEvents = (x, y) => 351 NoEvents = (x, y) =>
@@ -371,7 +369,7 @@ namespace OpenSim.Region.ClientStack.Linden
371 }; 369 };
372 } 370 }
373 371
374 public void Process(aPollRequest requestinfo) 372 public void Process(APollRequest requestinfo)
375 { 373 {
376 if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown) 374 if(m_module == null || m_module.Scene == null || m_module.Scene.ShuttingDown)
377 return; 375 return;
@@ -477,23 +475,26 @@ namespace OpenSim.Region.ClientStack.Linden
477 475
478 private static void DoInventoryRequests() 476 private static void DoInventoryRequests()
479 { 477 {
478 APollRequest poolreq;
480 while (true) 479 while (true)
481 { 480 {
482 aPollRequest poolreq = m_queue.Dequeue(4500); 481 if(!m_queue.TryTake(out poolreq, 4500) || poolreq == null || poolreq.thepoll == null)
483 Watchdog.UpdateThread(); 482 {
483 Watchdog.UpdateThread();
484 continue;
485 }
484 486
485 if (poolreq != null && poolreq.thepoll != null) 487 Watchdog.UpdateThread();
488 try
486 { 489 {
487 try 490 APollRequest req = poolreq;
488 { 491 req.thepoll.Process(req);
489 poolreq.thepoll.Process(poolreq); 492 }
490 } 493 catch (Exception e)
491 catch (Exception e) 494 {
492 { 495 m_log.ErrorFormat(
493 m_log.ErrorFormat( 496 "[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {2}",
494 "[INVENTORY]: Failed to process queued inventory request {0} for {1}. Exception {2}", 497 poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e);
495 poolreq.reqID, poolreq.presence != null ? poolreq.presence.Name : "unknown", e);
496 }
497 } 498 }
498 } 499 }
499 } 500 }