private void MontiorRequests() { if (ServiceConfiguration.EnableRequestCancellation) { while (_monitorRequests) { try { if (_clientDictionary.Count > 0) { try { foreach (KeyValuePair <string, RequestLedger> requestInfo in _clientDictionary) { RequestLedger ledger = requestInfo.Value as RequestLedger; if (ledger != null) { ledger.CancelTimedoutRequests(); } } } catch (ThreadAbortException) { } } } catch { } Thread.Sleep(_threadSleepTime); } } }
public void RegisterClientrequestsInLedger(string requestSource, ILogger logger, long requestId, ICancellableRequest command) { if (requestSource != null && !string.IsNullOrEmpty(requestSource)) { RequestLedger ledger = null; ledger = _clientDictionary.GetOrAdd(requestSource, new RequestLedger(requestSource, logger)); ledger.AddRequet(requestId, command); } }
public void RemoveClientRequests(string requestSource) { if (requestSource != null && !string.IsNullOrEmpty(requestSource)) { RequestLedger ledger = null; if (!_clientDictionary.TryGetValue(requestSource, out ledger)) { ledger.Dispoe(); } } }
public void UnRegisterClientRequests(string requestSource, long requestId) { RequestLedger ledger = null; if (_clientDictionary.TryGetValue(requestSource, out ledger)) { if (ledger != null) { ledger.RemoveRequest(requestId); } } }