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); } } }
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; } } } } } }
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; } } } } } }