internal void RemovePendingGetChannel(string channelId) { if (this.pendingRequestChannels != null) { lock (this.pendingRequestChannels) { PendingRequestChannel pendingGetChannel = this.GetPendingGetChannel(channelId); if (pendingGetChannel != null) { this.pendingRequestChannels.Remove(channelId); pendingGetChannel.Dispose(); } this.listenerChannelsManager.RemovePendingGetChannel(channelId); } } ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[PendingRequestManager::RemovePendingGetChannel] ChannelId: {0}", channelId); try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { if (this.userContext.NotificationManager != null) { this.userContext.NotificationManager.ReleaseSubscriptionsForChannelId(channelId); } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "MapiNotificationHandlerBase.DisposeXSOObjects Unable to dispose object. exception {0}", ex.Message); } }
protected override void InternalDispose(bool isDisposing) { if (!this.disposed && isDisposing) { try { OwaDiagnostics.SendWatsonReportsForGrayExceptions(delegate() { try { bool flag = false; try { flag = this.notifiersStateLock.LockWriterElastic(5000); } catch (OwaLockTimeoutException) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Dispose was called but the writer lock is not available:"); return; } if (!flag) { ExTraceGlobals.NotificationsCallTracer.TraceDebug((long)this.GetHashCode(), "Dispose was called but the writer lock is not available:"); return; } foreach (KeyValuePair <IPendingRequestNotifier, PendingRequestManager.PendingNotifierState> keyValuePair in this.notifierDataAvailableState) { keyValuePair.Value.Dispose(); } this.notifierDataAvailableState = null; } finally { if (this.notifiersStateLock.IsWriterLockHeld) { this.notifiersStateLock.ReleaseWriterLock(); } } lock (this.pendingRequestChannels) { if (this.pendingRequestChannels != null) { foreach (string channelId in this.pendingRequestChannels.Keys) { PendingRequestChannel pendingGetChannel = this.GetPendingGetChannel(channelId); if (pendingGetChannel != null) { pendingGetChannel.Dispose(); } this.listenerChannelsManager.RemovePendingGetChannel(channelId); } } this.pendingRequestChannels.Clear(); this.pendingRequestChannels = null; } if (this.budget != null) { this.budget.Dispose(); this.budget = null; } }); } catch (GrayException ex) { ExTraceGlobals.NotificationsCallTracer.TraceError <string>(0L, "MapiNotificationHandlerBase.DisposeXSOObjects Unable to dispose object. exception {0}", ex.Message); } this.disposed = true; } }