diff options
author | Melanie | 2012-07-05 23:09:20 +0200 |
---|---|---|
committer | Melanie | 2012-07-05 23:09:20 +0200 |
commit | 4854d779041e987ae13de4f30a37e4fab1b7a3d7 (patch) | |
tree | 6e05bd38feb13797c5137d70a13e4e09bfe94745 /OpenSim/Framework | |
parent | use the pollEvent timeout paramenter on pooling (diff) | |
download | opensim-SC_OLD-4854d779041e987ae13de4f30a37e4fab1b7a3d7.zip opensim-SC_OLD-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.gz opensim-SC_OLD-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.bz2 opensim-SC_OLD-4854d779041e987ae13de4f30a37e4fab1b7a3d7.tar.xz |
Add an EventType enum and Type field to the poll service event args. This allows
the manager to tell what type of event it is. All events except for lsl http in
go to the "slow queue" which is run once per second as before.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 37 |
2 files changed, 34 insertions, 11 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 2407533..7c92a50 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -45,6 +45,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | public RequestMethod Request; | 45 | public RequestMethod Request; |
46 | public UUID Id; | 46 | public UUID Id; |
47 | public int TimeOutms; | 47 | public int TimeOutms; |
48 | public EventType Type; | ||
49 | |||
50 | public enum EventType : int | ||
51 | { | ||
52 | Normal = 0, | ||
53 | LslHttp = 1 | ||
54 | } | ||
48 | 55 | ||
49 | public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms) | 56 | public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, UUID pId, int pTimeOutms) |
50 | { | 57 | { |
@@ -54,6 +61,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
54 | NoEvents = pNoEvents; | 61 | NoEvents = pNoEvents; |
55 | Id = pId; | 62 | Id = pId; |
56 | TimeOutms = pTimeOutms; | 63 | TimeOutms = pTimeOutms; |
64 | Type = EventType.Normal; | ||
57 | } | 65 | } |
58 | } | 66 | } |
59 | } | 67 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 45b1375..c7c7c13 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -174,13 +174,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
174 | private readonly BaseHttpServer m_server; | 174 | private readonly BaseHttpServer m_server; |
175 | 175 | ||
176 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | 176 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); |
177 | private static Queue<PollServiceHttpRequest> m_retry_requests = new Queue<PollServiceHttpRequest>(); | 177 | private BlockingQueue<PollServiceHttpRequest> m_slowRequests = new BlockingQueue<PollServiceHttpRequest>(); |
178 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | ||
178 | 179 | ||
179 | private uint m_WorkerThreadCount = 0; | 180 | private uint m_WorkerThreadCount = 0; |
180 | private Thread[] m_workerThreads; | 181 | private Thread[] m_workerThreads; |
181 | private Thread m_retrysThread; | 182 | private Thread m_retrysThread; |
182 | 183 | ||
183 | private bool m_running = true; | 184 | private bool m_running = true; |
185 | private int slowCount = 0; | ||
184 | 186 | ||
185 | // private int m_timeout = 1000; // increase timeout 250; now use the event one | 187 | // private int m_timeout = 1000; // increase timeout 250; now use the event one |
186 | 188 | ||
@@ -195,7 +197,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
195 | { | 197 | { |
196 | m_workerThreads[i] | 198 | m_workerThreads[i] |
197 | = Watchdog.StartThread( | 199 | = Watchdog.StartThread( |
198 | poolWorkerJob, | 200 | PoolWorkerJob, |
199 | String.Format("PollServiceWorkerThread{0}", i), | 201 | String.Format("PollServiceWorkerThread{0}", i), |
200 | ThreadPriority.Normal, | 202 | ThreadPriority.Normal, |
201 | false, | 203 | false, |
@@ -217,15 +219,20 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
217 | { | 219 | { |
218 | if (m_running) | 220 | if (m_running) |
219 | { | 221 | { |
220 | lock (m_retry_requests) | 222 | lock (m_retryRequests) |
221 | m_retry_requests.Enqueue(req); | 223 | m_retryRequests.Enqueue(req); |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | public void Enqueue(PollServiceHttpRequest req) | 227 | public void Enqueue(PollServiceHttpRequest req) |
226 | { | 228 | { |
227 | if (m_running) | 229 | if (m_running) |
228 | m_requests.Enqueue(req); | 230 | { |
231 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp) | ||
232 | m_slowRequests.Enqueue(req); | ||
233 | else | ||
234 | m_requests.Enqueue(req); | ||
235 | } | ||
229 | } | 236 | } |
230 | 237 | ||
231 | private void CheckRetries() | 238 | private void CheckRetries() |
@@ -234,10 +241,18 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
234 | { | 241 | { |
235 | Thread.Sleep(100); // let the world move .. back to faster rate | 242 | Thread.Sleep(100); // let the world move .. back to faster rate |
236 | Watchdog.UpdateThread(); | 243 | Watchdog.UpdateThread(); |
237 | lock (m_retry_requests) | 244 | lock (m_retryRequests) |
238 | { | 245 | { |
239 | while (m_retry_requests.Count > 0 && m_running) | 246 | while (m_retryRequests.Count > 0 && m_running) |
240 | Enqueue(m_retry_requests.Dequeue()); | 247 | m_requests.Enqueue(m_retryRequests.Dequeue()); |
248 | } | ||
249 | slowCount++; | ||
250 | if (slowCount >= 10) | ||
251 | { | ||
252 | slowCount = 0; | ||
253 | |||
254 | while (m_slowRequests.Count() > 0 && m_running) | ||
255 | m_requests.Enqueue(m_retryRequests.Dequeue()); | ||
241 | } | 256 | } |
242 | } | 257 | } |
243 | } | 258 | } |
@@ -261,7 +276,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
261 | 276 | ||
262 | try | 277 | try |
263 | { | 278 | { |
264 | foreach (PollServiceHttpRequest req in m_retry_requests) | 279 | foreach (PollServiceHttpRequest req in m_retryRequests) |
265 | { | 280 | { |
266 | m_server.DoHTTPGruntWork( | 281 | m_server.DoHTTPGruntWork( |
267 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), | 282 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), |
@@ -273,7 +288,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
273 | } | 288 | } |
274 | 289 | ||
275 | PollServiceHttpRequest wreq; | 290 | PollServiceHttpRequest wreq; |
276 | m_retry_requests.Clear(); | 291 | m_retryRequests.Clear(); |
277 | 292 | ||
278 | while (m_requests.Count() > 0) | 293 | while (m_requests.Count() > 0) |
279 | { | 294 | { |
@@ -294,7 +309,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
294 | 309 | ||
295 | // work threads | 310 | // work threads |
296 | 311 | ||
297 | private void poolWorkerJob() | 312 | private void PoolWorkerJob() |
298 | { | 313 | { |
299 | PollServiceHttpRequest req; | 314 | PollServiceHttpRequest req; |
300 | StreamReader str; | 315 | StreamReader str; |