diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 56 |
1 files changed, 6 insertions, 50 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 571e8d8..0e4323a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -44,25 +44,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | /// <summary> | ||
48 | /// Is the poll service request manager running? | ||
49 | /// </summary> | ||
50 | /// <remarks> | ||
51 | /// Can be running either synchronously or asynchronously | ||
52 | /// </remarks> | ||
53 | public bool IsRunning { get; private set; } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Is the poll service performing responses asynchronously (with its own threads) or synchronously (via | ||
57 | /// external calls)? | ||
58 | /// </summary> | ||
59 | public bool PerformResponsesAsync { get; private set; } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Number of responses actually processed and sent to viewer (or aborted due to error). | ||
63 | /// </summary> | ||
64 | public int ResponsesProcessed { get; private set; } | ||
65 | |||
66 | private readonly BaseHttpServer m_server; | 47 | private readonly BaseHttpServer m_server; |
67 | 48 | ||
68 | private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext; | 49 | private Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>> m_bycontext; |
@@ -74,7 +55,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
74 | private Thread[] m_workerThreads; | 55 | private Thread[] m_workerThreads; |
75 | private Thread m_retrysThread; | 56 | private Thread m_retrysThread; |
76 | 57 | ||
77 | private bool m_running = true; | 58 | private bool m_running = false; |
78 | private int slowCount = 0; | 59 | private int slowCount = 0; |
79 | 60 | ||
80 | private SmartThreadPool m_threadPool; | 61 | private SmartThreadPool m_threadPool; |
@@ -84,37 +65,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
84 | BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) | 65 | BaseHttpServer pSrv, bool performResponsesAsync, uint pWorkerThreadCount, int pTimeout) |
85 | { | 66 | { |
86 | m_server = pSrv; | 67 | m_server = pSrv; |
87 | PerformResponsesAsync = performResponsesAsync; | ||
88 | m_WorkerThreadCount = pWorkerThreadCount; | 68 | m_WorkerThreadCount = pWorkerThreadCount; |
89 | m_workerThreads = new Thread[m_WorkerThreadCount]; | 69 | m_workerThreads = new Thread[m_WorkerThreadCount]; |
90 | 70 | ||
91 | /* | ||
92 | StatsManager.RegisterStat( | ||
93 | new Stat( | ||
94 | "QueuedPollResponses", | ||
95 | "Number of poll responses queued for processing.", | ||
96 | "", | ||
97 | "", | ||
98 | "httpserver", | ||
99 | m_server.Port.ToString(), | ||
100 | StatType.Pull, | ||
101 | MeasuresOfInterest.AverageChangeOverTime, | ||
102 | stat => stat.Value = m_requests.Count(), | ||
103 | StatVerbosity.Debug)); | ||
104 | |||
105 | StatsManager.RegisterStat( | ||
106 | new Stat( | ||
107 | "ProcessedPollResponses", | ||
108 | "Number of poll responses processed.", | ||
109 | "", | ||
110 | "", | ||
111 | "httpserver", | ||
112 | m_server.Port.ToString(), | ||
113 | StatType.Pull, | ||
114 | MeasuresOfInterest.AverageChangeOverTime, | ||
115 | stat => stat.Value = ResponsesProcessed, | ||
116 | StatVerbosity.Debug)); | ||
117 | */ | ||
118 | PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); | 71 | PollServiceHttpRequestComparer preqCp = new PollServiceHttpRequestComparer(); |
119 | m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp); | 72 | m_bycontext = new Dictionary<PollServiceHttpRequest, Queue<PollServiceHttpRequest>>(preqCp); |
120 | 73 | ||
@@ -127,10 +80,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
127 | startInfo.ThreadPoolName = "PoolService"; | 80 | startInfo.ThreadPoolName = "PoolService"; |
128 | 81 | ||
129 | m_threadPool = new SmartThreadPool(startInfo); | 82 | m_threadPool = new SmartThreadPool(startInfo); |
83 | |||
130 | } | 84 | } |
131 | 85 | ||
132 | public void Start() | 86 | public void Start() |
133 | { | 87 | { |
88 | m_running = true; | ||
134 | m_threadPool.Start(); | 89 | m_threadPool.Start(); |
135 | //startup worker threads | 90 | //startup worker threads |
136 | for (uint i = 0; i < m_WorkerThreadCount; i++) | 91 | for (uint i = 0; i < m_WorkerThreadCount; i++) |
@@ -154,12 +109,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
154 | true, | 109 | true, |
155 | null, | 110 | null, |
156 | 1000 * 60 * 10); | 111 | 1000 * 60 * 10); |
112 | |||
157 | 113 | ||
158 | } | 114 | } |
159 | 115 | ||
160 | private void ReQueueEvent(PollServiceHttpRequest req) | 116 | private void ReQueueEvent(PollServiceHttpRequest req) |
161 | { | 117 | { |
162 | if (IsRunning) | 118 | if (m_running) |
163 | { | 119 | { |
164 | lock (m_retryRequests) | 120 | lock (m_retryRequests) |
165 | m_retryRequests.Enqueue(req); | 121 | m_retryRequests.Enqueue(req); |
@@ -207,7 +163,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
207 | 163 | ||
208 | public void EnqueueInt(PollServiceHttpRequest req) | 164 | public void EnqueueInt(PollServiceHttpRequest req) |
209 | { | 165 | { |
210 | if (IsRunning) | 166 | if (m_running) |
211 | { | 167 | { |
212 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) | 168 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.LongPoll) |
213 | { | 169 | { |