Пример #1
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && failures < RedisSentinel.MaxFailures)
            {
                try
                {
                    worker = GetNextSentinel();
                    clientManager = worker.GetClientManager();
                    worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (worker != null)
                    {
                        worker.SentinelError -= Worker_SentinelError;
                        worker.Dispose();
                    }

                    failures++;
                }
            }
        }
Пример #2
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && ShouldRetry())
            {
                try
                {
                    this.worker        = GetNextSentinel();
                    this.clientManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (this.worker != null)
                    {
                        this.worker.SentinelError -= Worker_SentinelError;
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }
        }
Пример #3
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && ShouldRetry())
            {
                try
                {
                    this.worker = GetNextSentinel();
                    this.clientManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (this.worker != null)
                    {
                        this.worker.SentinelError -= Worker_SentinelError;
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }
        }
Пример #4
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && failures < RedisSentinel.MaxFailures)
            {
                try
                {
                    worker        = GetNextSentinel();
                    clientManager = worker.GetClientManager();
                    worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (worker != null)
                    {
                        worker.SentinelError -= Worker_SentinelError;
                        worker.Dispose();
                    }

                    failures++;
                }
            }
        }
Пример #5
0
        private RedisSentinelWorker GetValidSentinel()
        {
            if (this.worker != null)
            {
                return(this.worker);
            }

            RedisException lastEx = null;

            while (this.RedisManager == null && ShouldRetry())
            {
                try
                {
                    this.worker       = GetNextSentinel();
                    this.RedisManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                    return(this.worker);
                }
                catch (RedisException ex)
                {
                    if (OnWorkerError != null)
                    {
                        OnWorkerError(ex);
                    }

                    lastEx = ex;
                    if (this.worker != null)
                    {
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }

            throw new RedisException("RedisSentinel is not accessible", lastEx);
        }
        private RedisSentinelWorker GetValidSentinel()
        {
            if (this.worker != null)
                return this.worker;

            RedisException lastEx = null;

            while (this.RedisManager == null && ShouldRetry())
            {
                try
                {
                    this.worker = GetNextSentinel();
                    this.RedisManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                    return this.worker;
                }
                catch (RedisException ex)
                {
                    if (OnWorkerError != null)
                        OnWorkerError(ex);

                    lastEx = ex;
                    if (this.worker != null)
                        this.worker.Dispose();

                    this.failures++;
                }
            }

            throw new RedisException("RedisSentinel is not accessible", lastEx);
        }