示例#1
0
 internal void SetSubscriptionContext(SubscriptionContext subscriptionContext, int topicIndex)
 {
     lock (SubscriptionsLock)
     {
         if (!IsDisposed)
         {
             _subscriptions[topicIndex] = subscriptionContext;
         }
     }
 }
 internal void SetSubscriptionContext(SubscriptionContext subscriptionContext, int topicIndex)
 {
     lock (SubscriptionsLock)
     {
         if (!IsDisposed)
         {
             _subscriptions[topicIndex] = subscriptionContext;
         }
     }
 }
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (!IsDisposed)
                {
                    lock (TopicClientsLock)
                    {
                        lock (SubscriptionsLock)
                        {
                            for (int i = 0; i < TopicNames.Count; i++)
                            {
                                _topicClients[i].Close();
                                SubscriptionContext subscription = _subscriptions[i];
                                subscription.Receiver.Close();
                                _namespaceManager.DeleteSubscription(subscription.TopicPath, subscription.Name);
                            }

                            IsDisposed = true;
                        }
                    }
                }
            }
        }