Ejemplo n.º 1
0
 public void RemoveSubscriberFromSequence(string clientId, Sequence sequence)
 {
     if (sequence != null)
     {
         if (log.IsDebugEnabled)
         {
             log.Debug(__Res.GetString(__Res.SequenceManager_RemoveSubscriberSeq, clientId, sequence.Id));
         }
         lock (_objLock) {
             if (_clientIdToSequenceHash.Contains(clientId))
             {
                 ArrayList sequences = _clientIdToSequenceHash[clientId] as ArrayList;
                 for (int i = 0; i < sequences.Count; i++)
                 {
                     Sequence sequenceTmp = sequences[i] as Sequence;
                     if (sequence == sequenceTmp)
                     {
                         sequence.RemoveSubscriber(clientId);
                         //Delete the sequence if there are no subscribers left
                         if (sequence.SubscriberCount == 0)
                         {
                             if (log.IsDebugEnabled)
                             {
                                 log.Debug(__Res.GetString(__Res.SequenceManager_RemoveEmptySeq, sequence.Id));
                             }
                             RemoveSequence(sequence.Id);
                         }
                         sequences.RemoveAt(i);                                //remove this sequence from client's list
                         break;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void RemoveSubscriber(string clientId)
 {
     if (log.IsDebugEnabled)
     {
         log.Debug(__Res.GetString(__Res.SequenceManager_RemoveSubscriber, clientId));
     }
     lock (_objLock) {
         if (_clientIdToSequenceHash.Contains(clientId))
         {
             ArrayList sequences = _clientIdToSequenceHash[clientId] as ArrayList;
             for (int i = 0; i < sequences.Count; i++)
             {
                 Sequence sequence = sequences[i] as Sequence;
                 sequence.RemoveSubscriber(clientId);
                 //Delete the sequence if there are no subscribers left
                 if (sequence.SubscriberCount == 0)
                 {
                     if (log.IsDebugEnabled)
                     {
                         log.Debug(__Res.GetString(__Res.SequenceManager_RemoveEmptySeq, sequence.Id));
                     }
                     RemoveSequence(sequence.Id);
                 }
             }
             _clientIdToSequenceHash.Remove(clientId);
         }
     }
 }
Ejemplo n.º 3
0
		public void RemoveSubscriberFromSequence(string clientId, Sequence sequence) {
			if (sequence != null) {
				if (log.IsDebugEnabled)
					log.Debug(__Res.GetString(__Res.SequenceManager_RemoveSubscriberSeq, clientId, sequence.Id));
				lock (_objLock) {
					if (_clientIdToSequenceHash.Contains(clientId)) {
						ArrayList sequences = _clientIdToSequenceHash[clientId] as ArrayList;
						for (int i = 0; i < sequences.Count; i++) {
							Sequence sequenceTmp = sequences[i] as Sequence;
							if (sequence == sequenceTmp) {
								sequence.RemoveSubscriber(clientId);
								//Delete the sequence if there are no subscribers left
								if (sequence.SubscriberCount == 0) {
									if (log.IsDebugEnabled)
										log.Debug(__Res.GetString(__Res.SequenceManager_RemoveEmptySeq, sequence.Id));
									RemoveSequence(sequence.Id);
								}
								sequences.RemoveAt(i);//remove this sequence from client's list
								break;
							}
						}
					}
				}
			}
		}