Dispose() public method

public Dispose ( ) : void
return void
示例#1
0
        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'.");
        }
示例#2
0
        /// <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;
            }
        }
示例#3
0
 /// <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);
        }
示例#5
0
        /// <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;
            }
        }