ConnectionLifetimeExpired() public method

public ConnectionLifetimeExpired ( ) : bool
return bool
Example #1
0
        public void ReleaseConnection(Driver driver)
        {
            lock ((inUsePool as ICollection).SyncRoot)
            {
                if (inUsePool.Contains(driver))
                {
                    inUsePool.Remove(driver);
                }
            }

            if (driver.ConnectionLifetimeExpired() || beingCleared)
            {
                driver.Close();
                Debug.Assert(!idlePool.Contains(driver));
            }
            else
            {
                lock ((idlePool as ICollection).SyncRoot)
                {
                    EnqueueIdle(driver);
                }
            }

            Interlocked.Increment(ref available);
            autoEvent.Set();
        }
Example #2
0
        public void ReleaseConnection(Driver driver)
        {
            object syncRoot = ((ICollection)this.inUsePool).SyncRoot;

            lock (syncRoot)
            {
                if (this.inUsePool.Contains(driver))
                {
                    this.inUsePool.Remove(driver);
                }
            }
            if (driver.ConnectionLifetimeExpired() || this.beingCleared)
            {
                driver.Close();
            }
            else
            {
                syncRoot = ((ICollection)this.idlePool).SyncRoot;
                lock (syncRoot)
                {
                    this.EnqueueIdle(driver);
                }
            }
            Interlocked.Increment(ref this.available);
            this.autoEvent.Set();
        }
Example #3
0
        public void ReleaseConnection(Driver driver)
        {
            lock ((_inUsePool as ICollection).SyncRoot)
            {
                if (_inUsePool.Contains(driver))
                {
                    _inUsePool.Remove(driver);
                }
            }

            if (driver.ConnectionLifetimeExpired() || BeingCleared)
            {
                driver.Close();
                Debug.Assert(!_idlePool.Contains(driver));
            }
            else
            {
                lock ((_idlePool as ICollection).SyncRoot)
                {
                    EnqueueIdle(driver);
                }
            }

            lock (_dnsSrvLock)
            {
                if (driver.Settings.DnsSrv)
                {
                    var dnsSrvRecords = DnsResolver.GetDnsSrvRecords(DnsResolver.ServiceName);
                    FailoverManager.SetHostList(dnsSrvRecords.ConvertAll(r => new FailoverServer(r.Target, r.Port, null)),
                                                FailoverMethod.Sequential);

                    foreach (var idleConnection in _idlePool)
                    {
                        string idleServer = idleConnection.Settings.Server;
                        if (!FailoverManager.FailoverGroup.Hosts.Exists(h => h.Host == idleServer) && !idleConnection.IsInActiveUse)
                        {
                            idleConnection.Close();
                        }
                    }
                }
            }

            Interlocked.Increment(ref _available);
            _autoEvent.Set();
        }
Example #4
0
    public void ReleaseConnection(Driver driver)
    {
      lock ((inUsePool as ICollection).SyncRoot)
      {
        if (inUsePool.Contains(driver))
          inUsePool.Remove(driver);
      }

      if (driver.ConnectionLifetimeExpired() || beingCleared)
      {
        driver.Close();
        Debug.Assert(!idlePool.Contains(driver));
      }
      else
      {
        lock ((idlePool as ICollection).SyncRoot)
        {
          EnqueueIdle(driver);
        }
      }

      Interlocked.Increment(ref available);
      autoEvent.Set();
    }