Dispose() public method

public Dispose ( ) : void
return void
コード例 #1
0
        private RedisSentinelWorker GetNextSentinel()
        {
            RedisSentinelWorker disposeWorker = null;

            try
            {
                lock (oLock)
                {
                    if (this.worker != null)
                    {
                        disposeWorker = this.worker;
                        this.worker   = null;
                    }

                    if (++sentinelIndex >= SentinelEndpoints.Length)
                    {
                        sentinelIndex = 0;
                    }

                    var sentinelWorker = new RedisSentinelWorker(this, SentinelEndpoints[sentinelIndex])
                    {
                        OnSentinelError = OnSentinelError
                    };

                    return(sentinelWorker);
                }
            }
            finally
            {
                disposeWorker?.Dispose();
            }
        }
コード例 #2
0
 public void Dispose()
 {
     if (worker != null)
     {
         worker.Dispose();
         worker = null;
     }
 }
コード例 #3
0
 public void Dispose()
 {
     if (worker != null)
     {
         worker.SentinelError -= Worker_SentinelError;
         worker.Dispose();
         worker = null;
     }
 }
コード例 #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
ファイル: RedisSentinel.cs プロジェクト: rebider/soa
        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++;
                }
            }
        }
コード例 #6
0
        private RedisSentinelWorker GetNextSentinel()
        {
            RedisSentinelWorker disposeWorker = null;

            try
            {
                lock (oLock)
                {
                    if (this.worker != null)
                    {
                        disposeWorker = this.worker;
                        this.worker   = null;
                    }

                    if (++sentinelIndex >= SentinelEndpoints.Length)
                    {
                        sentinelIndex = 0;
                    }

                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug($"Attempt to connect to next sentinel '{SentinelEndpoints[sentinelIndex]}'...");
                    }

                    var sentinelWorker = new RedisSentinelWorker(this, SentinelEndpoints[sentinelIndex])
                    {
                        OnSentinelError = OnSentinelError
                    };

                    return(sentinelWorker);
                }
            }
            finally
            {
                disposeWorker?.Dispose();
            }
        }