public void Dispose() { this.Stop(); if (this.aggregationPoller != null) { this.aggregationPoller.Dispose(); this.aggregationPoller = null; } if (this.server != null) { this.server.Dispose(); this.server = null; } if (this.registrationClient != null) { this.registrationClient.Dispose(); this.registrationClient = null; } foreach (var handler in this.requestHandlers.Values) { if (handler.taskRunner != this.taskRunner) { handler.taskRunner.Dispose(); handler.taskRunner = null; } } if (this.ServerList != null) { this.ServerList.Dispose(); this.ServerList = null; } if (this.taskRunner != null) { this.taskRunner.Dispose(); this.taskRunner = null; } }
public AggregationPoller(ServerList serverList, DataManager dataManager, TimeSpan pollingInterval) { if (serverList == null) { throw new ArgumentNullException("serverList"); } if (dataManager == null) { throw new ArgumentNullException("dataManager"); } if (pollingInterval <= TimeSpan.Zero) { throw new ArgumentOutOfRangeException("pollingInterval"); } serverList.LatestCounterTimeUpdated += this.UpdateServerCounterTime; this.dataManager = dataManager; this.pollingInterval = pollingInterval; this.taskRunner = new SemaphoreTaskRunner(this.dataManager.Counters.Count()); }