public void NotifyObservers(LocalResource resource) { String path = resource.Path; lock (_sync) { if (_observersByResource.ContainsKey(path)) { IDictionary <String, Observationship> resourceObservers = _observersByResource[path]; if (resourceObservers.Count > 0) { if (log.IsDebugEnabled) { log.Debug(String.Format("Notifying observers: {0} @ {1}", resourceObservers.Count, path)); } Int32 check = _intervalByResource.ContainsKey(path) ? (_intervalByResource[path] - 1) : _checkInterval; if (check <= 0) { _intervalByResource[path] = _checkInterval; if (log.IsDebugEnabled) { log.Debug("Refreshing observationship: " + path); } } else { _intervalByResource[path] = check; } foreach (Observationship observer in resourceObservers.Values) { Request request = observer.request; request.Type = check <= 0 ? MessageType.CON : MessageType.NON; resource.DoGet(request); PrepareResponse(request); if (request.PeerAddress == null) { request.HandleResponse(request.Response); } else { request.Response.Send(); } } } } } }