public bool Submit(string namespaceName, RemoteConfigRepository remoteConfigRepository)
        {
            ISet <RemoteConfigRepository> remoteConfigRepositories = null;

            m_longPollNamespaces.TryGetValue(namespaceName, out remoteConfigRepositories);
            if (remoteConfigRepositories == null)
            {
                lock (this)
                {
                    m_longPollNamespaces.TryGetValue(namespaceName, out remoteConfigRepositories);
                    if (remoteConfigRepositories == null)
                    {
                        remoteConfigRepositories            = new HashSet <RemoteConfigRepository>();
                        m_longPollNamespaces[namespaceName] = remoteConfigRepositories;
                    }
                }
            }
            bool added = remoteConfigRepositories.Add(remoteConfigRepository);

            if (!m_notifications.ContainsKey(namespaceName))
            {
                lock (this)
                {
                    if (!m_notifications.ContainsKey(namespaceName))
                    {
                        m_notifications[namespaceName] = INIT_NOTIFICATION_ID;
                    }
                }
            }
            if (!m_longPollingStarted.ReadFullFence())
            {
                StartLongPolling();
            }
            return(added);
        }
Esempio n. 2
0
        public void Submit(string namespaceName, RemoteConfigRepository remoteConfigRepository)
        {
            var remoteConfigRepositories = _longPollNamespaces.GetOrAdd(namespaceName, _ => new HashSet <RemoteConfigRepository>());

            remoteConfigRepositories.Add(remoteConfigRepository);

            _notifications.TryAdd(namespaceName, InitNotificationId);

            if (!_longPollingStarted.ReadFullFence())
            {
                StartLongPolling();
            }
        }
        public void Submit(string namespaceName, RemoteConfigRepository remoteConfigRepository)
        {
            var remoteConfigRepositories = _longPollNamespaces.GetOrAdd(namespaceName, _ => new HashSet <RemoteConfigRepository>());

            lock (remoteConfigRepositories) remoteConfigRepositories.Add(remoteConfigRepository);

            _notifications.TryAdd(namespaceName, InitNotificationId);

            if (_cts == null)
            {
                StartLongPolling();
            }
        }