private HttpWorkerRequest DequeueRequest(bool localOnly) { Object wr = null; if (_count > 0) { lock (this) { if (_localQueue.Count > 0) { wr = _localQueue.Dequeue(); _count--; } else if (!localOnly && _externQueue.Count > 0) { wr = _externQueue.Dequeue(); _count--; } } if (wr != null) { PerfCounters.DecrementGlobalCounter(GlobalPerfCounter.REQUESTS_QUEUED); PerfCounters.DecrementCounter(AppPerfCounter.REQUESTS_IN_APPLICATION_QUEUE); } } return((HttpWorkerRequest)wr); }
private HttpWorkerRequest DequeueRequest(bool localOnly) { HttpWorkerRequest wr = null; while (_count > 0) { lock (this) { if (_localQueue.Count > 0) { wr = (HttpWorkerRequest)_localQueue.Dequeue(); _count--; } else if (!localOnly && _externQueue.Count > 0) { wr = (HttpWorkerRequest)_externQueue.Dequeue(); _count--; } } if (wr == null) { break; } else { PerfCounters.DecrementGlobalCounter(GlobalPerfCounter.REQUESTS_QUEUED); PerfCounters.DecrementCounter(AppPerfCounter.REQUESTS_IN_APPLICATION_QUEUE); if (EtwTrace.IsTraceEnabled(EtwTraceLevel.Information, EtwTraceFlags.Infrastructure)) { EtwTrace.Trace(EtwTraceType.ETW_TYPE_REQ_DEQUEUED, wr); } if (!CheckClientConnected(wr)) { HttpRuntime.RejectRequestNow(wr, true); wr = null; PerfCounters.IncrementGlobalCounter(GlobalPerfCounter.REQUESTS_DISCONNECTED); PerfCounters.IncrementCounter(AppPerfCounter.APP_REQUEST_DISCONNECTED); } else { break; } } } return(wr); }
private HttpWorkerRequest DequeueRequest(bool localOnly) { HttpWorkerRequest workerRequest = null; while (this._count > 0) { lock (this) { if (this._localQueue.Count > 0) { workerRequest = (HttpWorkerRequest)this._localQueue.Dequeue(); this._count--; } else if (!localOnly && (this._externQueue.Count > 0)) { workerRequest = (HttpWorkerRequest)this._externQueue.Dequeue(); this._count--; } } if (workerRequest == null) { return(workerRequest); } PerfCounters.DecrementGlobalCounter(GlobalPerfCounter.REQUESTS_QUEUED); PerfCounters.DecrementCounter(AppPerfCounter.REQUESTS_IN_APPLICATION_QUEUE); if (EtwTrace.IsTraceEnabled(4, 1)) { EtwTrace.Trace(EtwTraceType.ETW_TYPE_REQ_DEQUEUED, workerRequest); } if (this.CheckClientConnected(workerRequest)) { return(workerRequest); } HttpRuntime.RejectRequestNow(workerRequest, true); workerRequest = null; PerfCounters.IncrementGlobalCounter(GlobalPerfCounter.REQUESTS_DISCONNECTED); PerfCounters.IncrementCounter(AppPerfCounter.APP_REQUEST_DISCONNECTED); } return(workerRequest); }