aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs40
1 files changed, 24 insertions, 16 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 0840a9d..d9965b6 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -31,6 +31,7 @@ using System.Threading;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using HttpServer; 33using HttpServer;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Framework.Servers.HttpServer 36namespace OpenSim.Framework.Servers.HttpServer
36{ 37{
@@ -54,21 +55,27 @@ namespace OpenSim.Framework.Servers.HttpServer
54 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount]; 55 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
55 56
56 //startup worker threads 57 //startup worker threads
57 for (uint i=0;i<m_WorkerThreadCount;i++) 58 for (uint i = 0; i < m_WorkerThreadCount; i++)
58 { 59 {
59 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout); 60 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, pTimeout);
60 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent; 61 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
61 62
62 m_workerThreads[i] = new Thread(m_PollServiceWorkerThreads[i].ThreadStart); 63 m_workerThreads[i]
63 m_workerThreads[i].Name = String.Format("PollServiceWorkerThread{0}",i); 64 = Watchdog.StartThread(
64 //Can't add to thread Tracker here Referencing OpenSim.Framework creates circular reference 65 m_PollServiceWorkerThreads[i].ThreadStart,
65 m_workerThreads[i].Start(); 66 String.Format("PollServiceWorkerThread{0}", i),
67 ThreadPriority.Normal,
68 false,
69 int.MaxValue);
66 } 70 }
67 71
68 //start watcher threads 72 m_watcherThread
69 m_watcherThread = new Thread(ThreadStart); 73 = Watchdog.StartThread(
70 m_watcherThread.Name = "PollServiceWatcherThread"; 74 this.ThreadStart,
71 m_watcherThread.Start(); 75 "PollServiceWatcherThread",
76 ThreadPriority.Normal,
77 false,
78 1000 * 60 * 10);
72 } 79 }
73 80
74 internal void ReQueueEvent(PollServiceHttpRequest req) 81 internal void ReQueueEvent(PollServiceHttpRequest req)
@@ -83,10 +90,11 @@ namespace OpenSim.Framework.Servers.HttpServer
83 m_requests.Enqueue(req); 90 m_requests.Enqueue(req);
84 } 91 }
85 92
86 public void ThreadStart(object o) 93 public void ThreadStart()
87 { 94 {
88 while (m_running) 95 while (m_running)
89 { 96 {
97 Watchdog.UpdateThread();
90 ProcessQueuedRequests(); 98 ProcessQueuedRequests();
91 Thread.Sleep(1000); 99 Thread.Sleep(1000);
92 } 100 }
@@ -107,7 +115,7 @@ namespace OpenSim.Framework.Servers.HttpServer
107 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++) 115 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
108 { 116 {
109 //Loop over number of requests each thread handles. 117 //Loop over number of requests each thread handles.
110 for (int i=0;i<reqperthread && m_requests.Count > 0;i++) 118 for (int i = 0; i < reqperthread && m_requests.Count > 0; i++)
111 { 119 {
112 try 120 try
113 { 121 {
@@ -125,14 +133,14 @@ namespace OpenSim.Framework.Servers.HttpServer
125 133
126 } 134 }
127 135
128
129
130 ~PollServiceRequestManager() 136 ~PollServiceRequestManager()
131 { 137 {
132 foreach (object o in m_requests) 138 foreach (object o in m_requests)
133 { 139 {
134 PollServiceHttpRequest req = (PollServiceHttpRequest) o; 140 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
135 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); 141 m_server.DoHTTPGruntWork(
142 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
143 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
136 } 144 }
137 145
138 m_requests.Clear(); 146 m_requests.Clear();
@@ -144,4 +152,4 @@ namespace OpenSim.Framework.Servers.HttpServer
144 m_running = false; 152 m_running = false;
145 } 153 }
146 } 154 }
147} 155} \ No newline at end of file