public void StartReceivingEvents_WhenDisposed_ThrowObjectDisposedException() { // Arrange sut.Dispose(); // Act Action act = () => sut.StartReceivingEvents(); // Assert act.Should().Throw <ObjectDisposedException>().WithMessage( "Cannot access a disposed object.\r\nObject name: 'subscriptionClients'."); }
/// <summary> /// Stop the PO Box manager. /// </summary> public void Stop() { try { lock (this) { // stop collection managers subscriber.Enabled = false; invitationSubscriber.Enabled = false; foreach (string id in new ArrayList(boxManagers.Keys)) { RemovePOBoxManager(id); } subscriber.Dispose(); invitationSubscriber.Dispose(); } } catch (Exception e) { log.Error(e, "Unable to stop store manager."); throw e; } }
/// <summary> /// Called to stop the service. /// </summary> public void Stop() { shuttingDown = true; lock (eventQueue) { queueEvent.Set(); } journalThread.Join(); storeEvents.Dispose(); }
protected internal void Dispose() { if (IsDisposed) { return; } event_subscriber.Dispose(); IsDisposed = true; OnDisposed(DisposedEventArgs.Empty); }
/// <summary> /// Disposes the event subscribers. /// </summary> private void DisposeSubscribers() { log.Debug("{0} : Disposing all subscribers.", port); if (simiasNodeEventSubscriber != null) { simiasNodeEventSubscriber.Dispose(); simiasNodeEventSubscriber = null; } if (simiasSyncEventSubscriber != null) { simiasSyncEventSubscriber.Dispose(); simiasSyncEventSubscriber = null; } if (simiasNotifyEventSubscriber != null) { simiasNotifyEventSubscriber.Dispose(); simiasNotifyEventSubscriber = null; } }