Esempio n. 1
0
        public void ReturnConnection(ConnectionPoolEntry entry)
        {
            var key = entry.ConnectionString;

            entry.RecordCheckIn();
            avalableConnections[key].Push(entry);
        }
Esempio n. 2
0
        public ConnectionPoolEntry GetConnection(string connectionString)
        {
            var key = connectionString;

            ConnectionPoolEntry rv = null;

            avalableConnections.AddOrUpdate(key, k => new ConcurrentStack <ConnectionPoolEntry>(), (k, c) =>
            {
                while (c.TryPop(out var entry))
                {
                    //if we discover that the entry has expired, dispose of it
                    //this typically happens when the entry uses BEARER auth and its token
                    //has expired (or is about to).
                    if (DateTime.Now > entry.ValidTo.Subtract(TimeSpan.FromMinutes(1)))
                    {
                        entry.Connection.Dispose();
                        continue;
                    }

                    rv = entry;
                    break;
                }

                return(c);
            });
Esempio n. 3
0
 // private Logger log;
 public QueryResult(AdomdDataReader queryResults, bool gzip, bool bufferResults, ConnectionPoolEntry con, ConnectionPool pool, ILogger log)
 {
     this.queryResults  = queryResults;
     this.log           = log;
     this.gzip          = gzip;
     this.bufferResults = bufferResults;
     this.con           = con;
     this.pool          = pool;
 }